Skip to content

Rollup of 7 pull requests #136292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a56f9ad
remove Rule 3 from `ref_pat_eat_one_layer_2024`
dianne Jan 3, 2025
c57708a
add more tests where the rulesets disagree
dianne Jan 4, 2025
c037695
"structural" ruleset: account for dbm mutability cap in Deref(EatInne…
dianne Jan 5, 2025
f8315ae
"structural" ruleset: use the "classic" ruleset's diagnostic and fall…
dianne Jan 6, 2025
586ff15
"structural" ruleset: match against the inherited ref when a referenc…
dianne Jan 13, 2025
3f9b198
rename tests' revisions to allow testing multiple editions
dianne Jan 15, 2025
fdcbd71
minor test cleanup
dianne Jan 21, 2025
afd976b
add more information to old tests
dianne Jan 21, 2025
4ed44c9
add a stable edition 2021 revision to pattern typing tests
dianne Jan 21, 2025
f5567e1
organize old well-typed-edition-2024 tests
dianne Jan 21, 2025
e288cff
add tests differing between stable and new rules (with errors on new …
dianne Jan 21, 2025
ccb9674
simplify similar_tokens from Option<Vec<_>> to Vec<_>
hkBst Jan 22, 2025
5f01e12
simplify similar_tokens from Vec<_> to &[_]
hkBst Jan 22, 2025
be7d6e3
add work-in-progress unstable book chapters
dianne Jan 21, 2025
5df5193
Fix tests/codegen/float/f128
purplesyringa Jan 28, 2025
efaeede
Fix tests/codegen/wasm_exceptions
purplesyringa Jan 28, 2025
644e527
Fix tests/ui/privacy/sysroot-private
purplesyringa Jan 28, 2025
57cfcd2
use impl Into<String>
hkBst Jan 23, 2025
d93cbe5
Add new setting allowing to switch to sans serif fonts
GuillaumeGomez Dec 3, 2024
65fedeb
Add GUI test for new "sans serif fonts" setting
GuillaumeGomez Dec 3, 2024
91f6e00
Fix tidy errors
GuillaumeGomez Dec 3, 2024
999a25e
Fix tidy errors
GuillaumeGomez Dec 3, 2024
895564e
Add italic for newly added sans serif fonts
GuillaumeGomez Jan 18, 2025
22f0741
Add tests for transmuting pattern types
oli-obk Jan 28, 2025
a639e27
Allow transmuting generic pattern types to and from their base
oli-obk Jan 28, 2025
2511faf
Add SemiBold for SourceSerif4
GuillaumeGomez Jan 29, 2025
51eaa0d
Clean up uses of the unstable `dwarf_version` option
wesleywiser Jan 19, 2025
4d5a63f
Add tracking issue to docs
wesleywiser Jan 19, 2025
282d866
Rollup merge of #133636 - GuillaumeGomez:sans-serif, r=rustdoc
matthiaskrgr Jan 30, 2025
a366357
Rollup merge of #135434 - dianne:match-2024-for-edition-2024, r=Nadri…
matthiaskrgr Jan 30, 2025
aedc0a3
Rollup merge of #135739 - wesleywiser:dwarf_version_handling, r=lqd
matthiaskrgr Jan 30, 2025
78ded09
Rollup merge of #135882 - hkBst:master, r=estebank
matthiaskrgr Jan 30, 2025
aab61ad
Rollup merge of #136179 - oli-obk:push-vxvyttorquxw, r=BoxyUwU
matthiaskrgr Jan 30, 2025
d7668d8
Rollup merge of #136199 - purplesyringa:emscripten-tests, r=jieyouxu
matthiaskrgr Jan 30, 2025
9b7af17
Rollup merge of #136251 - hkBst:opt_imports, r=estebank
matthiaskrgr Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ impl<'tcx> SizeSkeleton<'tcx> {
}
}

// Pattern types are always the same size as their base.
ty::Pat(base, _) => SizeSkeleton::compute(base, tcx, typing_env),

_ => Err(err),
}
}
Expand Down
32 changes: 32 additions & 0 deletions tests/ui/type/pattern_types/transmute.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#![feature(pattern_types)]
#![feature(pattern_type_macro)]

use std::pat::pattern_type;

// ok
fn create<const S: u32, const E: u32>(x: u32) -> pattern_type!(u32 is S..=E) {
unsafe { std::mem::transmute(x) }
}

// ok
fn unwrap<const S: u32, const E: u32>(x: pattern_type!(u32 is S..=E)) -> u32 {
unsafe { std::mem::transmute(x) }
}

// bad, only when S != u32::MIN or E != u32::MAX will this ok
fn non_base_ty_transmute<const S: u32, const E: u32>(
x: Option<pattern_type!(u32 is S..=E)>,
) -> u32 {
unsafe { std::mem::transmute(x) }
//~^ ERROR types of different sizes
}

// bad, only when S = u32::MIN and E = u32::MAX will this ok
fn wrapped_transmute<const S: u32, const E: u32>(
x: Option<pattern_type!(u32 is S..=E)>,
) -> Option<u32> {
unsafe { std::mem::transmute(x) }
//~^ ERROR types of different sizes
}

fn main() {}
21 changes: 21 additions & 0 deletions tests/ui/type/pattern_types/transmute.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute.rs:20:14
|
LL | unsafe { std::mem::transmute(x) }
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `Option<(u32) is S..=E>` (size can vary because of u32)
= note: target type: `u32` (32 bits)

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute.rs:28:14
|
LL | unsafe { std::mem::transmute(x) }
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `Option<(u32) is S..=E>` (size can vary because of u32)
= note: target type: `Option<u32>` (64 bits)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0512`.