diff options
| author | bors <bors@rust-lang.org> | 2022-07-05 23:12:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-07-05 23:12:34 +0000 |
| commit | f342bea9d19f14616c6559312552e6d0ee529cfd (patch) | |
| tree | ebcd7b37e2b6a58192dd7e9a9d4f6e377fa23136 /src/test/ui/aligned_enum_cast.rs | |
| parent | 7b46aa594c4bdc507fbd904b6777ca30c37a9209 (diff) | |
| parent | 0eded16705a493d53c8b5c646e2eb4be68ba9224 (diff) | |
| download | rust-f342bea9d19f14616c6559312552e6d0ee529cfd.tar.gz rust-f342bea9d19f14616c6559312552e6d0ee529cfd.zip | |
Auto merge of #98963 - GuillaumeGomez:rollup-n030us5, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - #95503 (bootstrap: Allow building individual crates) - #96814 (Fix repr(align) enum handling) - #98256 (Fix whitespace handling after where clause) - #98880 (Proper macOS libLLVM symlink when cross compiling) - #98944 (Edit `rustc_mir_dataflow::framework::lattice::FlatSet` docs) - #98951 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test/ui/aligned_enum_cast.rs')
| -rw-r--r-- | src/test/ui/aligned_enum_cast.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/test/ui/aligned_enum_cast.rs b/src/test/ui/aligned_enum_cast.rs index 4b5776a6aa8..1ddf127172e 100644 --- a/src/test/ui/aligned_enum_cast.rs +++ b/src/test/ui/aligned_enum_cast.rs @@ -11,5 +11,15 @@ enum Aligned { fn main() { let aligned = Aligned::Zero; let fo = aligned as u8; - println!("foo {}",fo); + println!("foo {}", fo); + assert_eq!(fo, 0); + println!("{}", tou8(Aligned::Zero)); + assert_eq!(tou8(Aligned::Zero), 0); +} + +#[inline(never)] +fn tou8(al: Aligned) -> u8 { + // Cast behind a function call so ConstProp does not see it + // (so that we can test codegen). + al as u8 } |
