Skip to content

Commit e531888

Browse files
committed
fixup! Update expected MIR in tests
1 parent dee0393 commit e531888

13 files changed

+421
-456
lines changed

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,38 @@
1616
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1717
let mut _5: std::ptr::NonNull<[bool; 0]>;
1818
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
19-
let _6: std::ptr::Alignment;
20-
let mut _7: std::num::NonZero<usize>;
19+
let mut _6: std::num::NonZero<usize>;
2120
scope 6 {
22-
scope 10 (inlined std::ptr::Alignment::as_nonzero) {
23-
let mut _8: {closure@std::ptr::Alignment::as_nonzero::{closure#0}};
24-
let mut _9: std::num::NonZero<usize>;
25-
scope 11 {
21+
scope 12 (inlined std::ptr::Alignment::as_nonzero) {
22+
scope 13 {
23+
scope 14 {
24+
scope 15 {
25+
}
26+
}
2627
}
27-
scope 12 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
28+
scope 16 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
2829
}
2930
}
30-
scope 13 (inlined NonNull::<[bool; 0]>::without_provenance) {
31-
let _10: *const [bool; 0];
32-
scope 14 {
31+
scope 17 (inlined NonNull::<[bool; 0]>::without_provenance) {
32+
let _7: *const [bool; 0];
33+
scope 18 {
3334
}
34-
scope 15 (inlined NonZero::<usize>::get) {
35+
scope 19 (inlined NonZero::<usize>::get) {
3536
}
36-
scope 16 (inlined std::ptr::without_provenance::<[bool; 0]>) {
37-
scope 17 (inlined without_provenance_mut::<[bool; 0]>) {
37+
scope 20 (inlined std::ptr::without_provenance::<[bool; 0]>) {
38+
scope 21 (inlined without_provenance_mut::<[bool; 0]>) {
3839
}
3940
}
4041
}
4142
}
4243
scope 7 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
4344
scope 8 {
45+
scope 9 {
46+
scope 10 {
47+
}
48+
}
4449
}
45-
scope 9 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
50+
scope 11 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
4651
}
4752
}
4853
}
@@ -56,42 +61,33 @@
5661
StorageLive(_4);
5762
StorageLive(_5);
5863
StorageLive(_6);
59-
_6 = contract_check_ensures::<{closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, std::ptr::Alignment>(const ZeroSized: {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}) -> [return: bb2, unwind unreachable];
60-
}
61-
62-
bb1: {
63-
StorageDead(_1);
64-
return;
65-
}
66-
67-
bb2: {
64+
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
6865
StorageLive(_7);
69-
StorageLive(_8);
70-
_8 = {closure@$SRC_DIR/core/src/ptr/alignment.rs:LL:COL} { 0: copy _6 };
71-
StorageLive(_9);
72-
_9 = copy _6 as std::num::NonZero<usize> (Transmute);
73-
_7 = contract_check_ensures::<{closure@std::ptr::Alignment::as_nonzero::{closure#0}}, NonZero<usize>>(move _8, move _9) -> [return: bb3, unwind unreachable];
74-
}
75-
76-
bb3: {
77-
StorageDead(_9);
78-
StorageDead(_8);
79-
StorageLive(_10);
80-
_10 = copy _7 as *const [bool; 0] (Transmute);
81-
_5 = NonNull::<[bool; 0]> { pointer: copy _10 };
82-
StorageDead(_10);
66+
_7 = const {0x1 as *const [bool; 0]};
67+
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
8368
StorageDead(_7);
8469
StorageDead(_6);
85-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
70+
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8671
StorageDead(_5);
87-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
72+
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8873
StorageDead(_4);
89-
_2 = Box::<[bool]>(copy _3, const std::alloc::Global);
74+
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
9075
StorageDead(_3);
91-
_1 = A { foo: move _2 };
76+
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
9277
StorageDead(_2);
9378
_0 = const ();
9479
drop(_1) -> [return: bb1, unwind unreachable];
9580
}
81+
82+
bb1: {
83+
StorageDead(_1);
84+
return;
85+
}
9686
}
9787

88+
ALLOC2 (size: 8, align: 4) { .. }
89+
90+
ALLOC1 (size: 8, align: 4) { .. }
91+
92+
ALLOC0 (size: 8, align: 4) { .. }
93+

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,38 @@
1616
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1717
let mut _5: std::ptr::NonNull<[bool; 0]>;
1818
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
19-
let _6: std::ptr::Alignment;
20-
let mut _7: std::num::NonZero<usize>;
19+
let mut _6: std::num::NonZero<usize>;
2120
scope 6 {
22-
scope 10 (inlined std::ptr::Alignment::as_nonzero) {
23-
let mut _8: {closure@std::ptr::Alignment::as_nonzero::{closure#0}};
24-
let mut _9: std::num::NonZero<usize>;
25-
scope 11 {
21+
scope 12 (inlined std::ptr::Alignment::as_nonzero) {
22+
scope 13 {
23+
scope 14 {
24+
scope 15 {
25+
}
26+
}
2627
}
27-
scope 12 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
28+
scope 16 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
2829
}
2930
}
30-
scope 13 (inlined NonNull::<[bool; 0]>::without_provenance) {
31-
let _10: *const [bool; 0];
32-
scope 14 {
31+
scope 17 (inlined NonNull::<[bool; 0]>::without_provenance) {
32+
let _7: *const [bool; 0];
33+
scope 18 {
3334
}
34-
scope 15 (inlined NonZero::<usize>::get) {
35+
scope 19 (inlined NonZero::<usize>::get) {
3536
}
36-
scope 16 (inlined std::ptr::without_provenance::<[bool; 0]>) {
37-
scope 17 (inlined without_provenance_mut::<[bool; 0]>) {
37+
scope 20 (inlined std::ptr::without_provenance::<[bool; 0]>) {
38+
scope 21 (inlined without_provenance_mut::<[bool; 0]>) {
3839
}
3940
}
4041
}
4142
}
4243
scope 7 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
4344
scope 8 {
45+
scope 9 {
46+
scope 10 {
47+
}
48+
}
4449
}
45-
scope 9 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
50+
scope 11 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
4651
}
4752
}
4853
}
@@ -56,7 +61,22 @@
5661
StorageLive(_4);
5762
StorageLive(_5);
5863
StorageLive(_6);
59-
_6 = contract_check_ensures::<{closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, std::ptr::Alignment>(const ZeroSized: {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}) -> [return: bb3, unwind continue];
64+
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
65+
StorageLive(_7);
66+
_7 = const {0x1 as *const [bool; 0]};
67+
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
68+
StorageDead(_7);
69+
StorageDead(_6);
70+
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
71+
StorageDead(_5);
72+
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
73+
StorageDead(_4);
74+
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
75+
StorageDead(_3);
76+
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
77+
StorageDead(_2);
78+
_0 = const ();
79+
drop(_1) -> [return: bb1, unwind: bb2];
6080
}
6181

6282
bb1: {
@@ -67,35 +87,11 @@
6787
bb2 (cleanup): {
6888
resume;
6989
}
90+
}
7091

71-
bb3: {
72-
StorageLive(_7);
73-
StorageLive(_8);
74-
_8 = {closure@$SRC_DIR/core/src/ptr/alignment.rs:LL:COL} { 0: copy _6 };
75-
StorageLive(_9);
76-
_9 = copy _6 as std::num::NonZero<usize> (Transmute);
77-
_7 = contract_check_ensures::<{closure@std::ptr::Alignment::as_nonzero::{closure#0}}, NonZero<usize>>(move _8, move _9) -> [return: bb4, unwind continue];
78-
}
92+
ALLOC2 (size: 8, align: 4) { .. }
7993

80-
bb4: {
81-
StorageDead(_9);
82-
StorageDead(_8);
83-
StorageLive(_10);
84-
_10 = copy _7 as *const [bool; 0] (Transmute);
85-
_5 = NonNull::<[bool; 0]> { pointer: copy _10 };
86-
StorageDead(_10);
87-
StorageDead(_7);
88-
StorageDead(_6);
89-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
90-
StorageDead(_5);
91-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
92-
StorageDead(_4);
93-
_2 = Box::<[bool]>(copy _3, const std::alloc::Global);
94-
StorageDead(_3);
95-
_1 = A { foo: move _2 };
96-
StorageDead(_2);
97-
_0 = const ();
98-
drop(_1) -> [return: bb1, unwind: bb2];
99-
}
100-
}
94+
ALLOC1 (size: 8, align: 4) { .. }
95+
96+
ALLOC0 (size: 8, align: 4) { .. }
10197

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,38 @@
1616
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1717
let mut _5: std::ptr::NonNull<[bool; 0]>;
1818
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
19-
let _6: std::ptr::Alignment;
20-
let mut _7: std::num::NonZero<usize>;
19+
let mut _6: std::num::NonZero<usize>;
2120
scope 6 {
22-
scope 10 (inlined std::ptr::Alignment::as_nonzero) {
23-
let mut _8: {closure@std::ptr::Alignment::as_nonzero::{closure#0}};
24-
let mut _9: std::num::NonZero<usize>;
25-
scope 11 {
21+
scope 12 (inlined std::ptr::Alignment::as_nonzero) {
22+
scope 13 {
23+
scope 14 {
24+
scope 15 {
25+
}
26+
}
2627
}
27-
scope 12 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
28+
scope 16 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
2829
}
2930
}
30-
scope 13 (inlined NonNull::<[bool; 0]>::without_provenance) {
31-
let _10: *const [bool; 0];
32-
scope 14 {
31+
scope 17 (inlined NonNull::<[bool; 0]>::without_provenance) {
32+
let _7: *const [bool; 0];
33+
scope 18 {
3334
}
34-
scope 15 (inlined NonZero::<usize>::get) {
35+
scope 19 (inlined NonZero::<usize>::get) {
3536
}
36-
scope 16 (inlined std::ptr::without_provenance::<[bool; 0]>) {
37-
scope 17 (inlined without_provenance_mut::<[bool; 0]>) {
37+
scope 20 (inlined std::ptr::without_provenance::<[bool; 0]>) {
38+
scope 21 (inlined without_provenance_mut::<[bool; 0]>) {
3839
}
3940
}
4041
}
4142
}
4243
scope 7 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
4344
scope 8 {
45+
scope 9 {
46+
scope 10 {
47+
}
48+
}
4449
}
45-
scope 9 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
50+
scope 11 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
4651
}
4752
}
4853
}
@@ -56,42 +61,33 @@
5661
StorageLive(_4);
5762
StorageLive(_5);
5863
StorageLive(_6);
59-
_6 = contract_check_ensures::<{closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, std::ptr::Alignment>(const ZeroSized: {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}) -> [return: bb2, unwind unreachable];
60-
}
61-
62-
bb1: {
63-
StorageDead(_1);
64-
return;
65-
}
66-
67-
bb2: {
64+
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
6865
StorageLive(_7);
69-
StorageLive(_8);
70-
_8 = {closure@$SRC_DIR/core/src/ptr/alignment.rs:LL:COL} { 0: copy _6 };
71-
StorageLive(_9);
72-
_9 = copy _6 as std::num::NonZero<usize> (Transmute);
73-
_7 = contract_check_ensures::<{closure@std::ptr::Alignment::as_nonzero::{closure#0}}, NonZero<usize>>(move _8, move _9) -> [return: bb3, unwind unreachable];
74-
}
75-
76-
bb3: {
77-
StorageDead(_9);
78-
StorageDead(_8);
79-
StorageLive(_10);
80-
_10 = copy _7 as *const [bool; 0] (Transmute);
81-
_5 = NonNull::<[bool; 0]> { pointer: copy _10 };
82-
StorageDead(_10);
66+
_7 = const {0x1 as *const [bool; 0]};
67+
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
8368
StorageDead(_7);
8469
StorageDead(_6);
85-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
70+
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8671
StorageDead(_5);
87-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
72+
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8873
StorageDead(_4);
89-
_2 = Box::<[bool]>(copy _3, const std::alloc::Global);
74+
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
9075
StorageDead(_3);
91-
_1 = A { foo: move _2 };
76+
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
9277
StorageDead(_2);
9378
_0 = const ();
9479
drop(_1) -> [return: bb1, unwind unreachable];
9580
}
81+
82+
bb1: {
83+
StorageDead(_1);
84+
return;
85+
}
9686
}
9787

88+
ALLOC2 (size: 16, align: 8) { .. }
89+
90+
ALLOC1 (size: 16, align: 8) { .. }
91+
92+
ALLOC0 (size: 16, align: 8) { .. }
93+

0 commit comments

Comments
 (0)