mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
c9c80d2c5f
The only non-obvious changes: - `building/storage_live_dead_in_statics.rs` has a `#[rustfmt::skip]` attribute to avoid reformating a table of data. - Two `.mir` files have slight changes involving line numbers. - In `unusual_item_types.rs` an `EMIT_MIR` annotation is moved to outside a function, which is the usual spot, because `tidy` complains if such a comment is indented. The commit also tweaks the comments in `rustfmt.toml`.
32 lines
594 B
Rust
32 lines
594 B
Rust
// skip-filecheck
|
|
//@ compile-flags: -Z mir-opt-level=1
|
|
// Regression test for #72181, this ICE requires `-Z mir-opt-level=1` flags.
|
|
|
|
use std::mem;
|
|
|
|
#[derive(Copy, Clone)]
|
|
enum Never {}
|
|
|
|
union Foo {
|
|
a: u64,
|
|
b: Never,
|
|
}
|
|
|
|
// EMIT_MIR issue_72181.foo.built.after.mir
|
|
fn foo(xs: [(Never, u32); 1]) -> u32 {
|
|
xs[0].1
|
|
}
|
|
|
|
// EMIT_MIR issue_72181.bar.built.after.mir
|
|
fn bar([(_, x)]: [(Never, u32); 1]) -> u32 {
|
|
x
|
|
}
|
|
|
|
// EMIT_MIR issue_72181.main.built.after.mir
|
|
fn main() {
|
|
let _ = mem::size_of::<Foo>();
|
|
|
|
let f = [Foo { a: 42 }, Foo { a: 10 }];
|
|
let _ = unsafe { f[0].a };
|
|
}
|