diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-12 06:29:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-12 06:29:02 +0100 |
| commit | b4cbc882eb1bdf9aee29fd8cafd7779a5a4da068 (patch) | |
| tree | b5e41642796a4258daa4ab4e3ea507c8713939b2 | |
| parent | 60ab300d47c1a4923e69302fc2ea307236ef2d94 (diff) | |
| parent | ba70528fd8cfbc1bf3d0b08c60dd753d6865d8a6 (diff) | |
| download | rust-b4cbc882eb1bdf9aee29fd8cafd7779a5a4da068.tar.gz rust-b4cbc882eb1bdf9aee29fd8cafd7779a5a4da068.zip | |
Rollup merge of #121865 - Kirandevraj:unnamed-fields-filecheck, r=oli-obk
Add FileCheck annotations to MIR-opt unnamed-fields tests Part of #116971 Adds filecheck annotations to unnamed-fields mir-opt tests in `tests/mir-opt/unnamed-fields`
| -rw-r--r-- | tests/mir-opt/unnamed-fields/field_access.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/mir-opt/unnamed-fields/field_access.rs b/tests/mir-opt/unnamed-fields/field_access.rs index 3d33ca26875..5badfa1646b 100644 --- a/tests/mir-opt/unnamed-fields/field_access.rs +++ b/tests/mir-opt/unnamed-fields/field_access.rs @@ -1,4 +1,5 @@ -// skip-filecheck +// Tests the correct handling of unnamed fields within structs and unions marked with #[repr(C)]. + // EMIT_MIR field_access.foo.SimplifyCfg-initial.after.mir // EMIT_MIR field_access.bar.SimplifyCfg-initial.after.mir @@ -36,18 +37,36 @@ union Bar { fn access<T>(_: T) {} +// CHECK-LABEL: fn foo( fn foo(foo: Foo) { + // CHECK [[a:_.*]] = (_1.0: u8); + // CHECK _.* = access::<u8>(move [[a]]) -> [return: bb1, unwind: bb5]; access(foo.a); + // CHECK [[b:_.*]] = ((_1.1: Foo::{anon_adt#0}).0: i8); + // CHECK _.* = access::<i8>(move [[b]]) -> [return: bb2, unwind: bb5]; access(foo.b); + // CHECK [[c:_.*]] = ((_1.1: Foo::{anon_adt#0}).1: bool); + // CHECK _.* = access::<bool>(move [[c]]) -> [return: bb3, unwind: bb5]; access(foo.c); + // CHECK [[d:_.*]] = (((_1.2: Foo::{anon_adt#1}).0: Foo::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); + // CHECK _.* = access::<[u8; 1]>(move [[d]]) -> [return: bb4, unwind: bb5]; access(foo.d); } +// CHECK-LABEL: fn bar( fn bar(bar: Bar) { unsafe { + // CHECK [[a:_.*]] = (_1.0: u8); + // CHECK _.* = access::<u8>(move [[a]]) -> [return: bb1, unwind: bb5]; access(bar.a); + // CHECK [[b:_.*]] = ((_1.1: Bar::{anon_adt#0}).0: i8); + // CHECK _.* = access::<i8>(move [[b]]) -> [return: bb2, unwind: bb5]; access(bar.b); + // CHECK [[c:_.*]] = ((_1.1: Bar::{anon_adt#0}).1: bool); + // CHECK _.* = access::<bool>(move [[c]]) -> [return: bb3, unwind: bb5]; access(bar.c); + // CHECK [[d:_.*]] = (((_1.2: Bar::{anon_adt#1}).0: Bar::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); + // CHECK _.* = access::<[u8; 1]>(move [[d]]) -> [return: bb4, unwind: bb5]; access(bar.d); } } |
