Skip to content

Commit 899aa31

Browse files
committed
Const-prop pointers.
1 parent 5f345bc commit 899aa31

9 files changed

+177
-48
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,19 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
563563
.ok()?;
564564
dest.into()
565565
}
566+
CastKind::FnPtrToPtr
567+
| CastKind::PtrToPtr
568+
| CastKind::PointerCoercion(
569+
ty::adjustment::PointerCoercion::MutToConstPointer
570+
| ty::adjustment::PointerCoercion::ArrayToPointer
571+
| ty::adjustment::PointerCoercion::UnsafeFnPointer,
572+
) => {
573+
let src = self.evaluated[value].as_ref()?;
574+
let src = self.ecx.read_immediate(src).ok()?;
575+
let to = self.ecx.layout_of(to).ok()?;
576+
let ret = self.ecx.ptr_to_ptr(&src, to).ok()?;
577+
ret.into()
578+
}
566579
_ => return None,
567580
},
568581
};

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@
7474
StorageDead(_7);
7575
StorageLive(_8);
7676
StorageLive(_9);
77-
_8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
78-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
77+
_8 = const {0x1 as *const [bool; 0]};
78+
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
7979
StorageDead(_9);
8080
StorageDead(_8);
8181
StorageDead(_6);
82-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
82+
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8383
StorageDead(_5);
84-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
84+
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8585
StorageDead(_4);
86-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
86+
_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);
8787
StorageDead(_3);
88-
_1 = A { foo: move _2 };
88+
_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) }};
8989
StorageDead(_2);
9090
_0 = const ();
9191
drop(_1) -> [return: bb1, unwind unreachable];
@@ -97,3 +97,15 @@
9797
}
9898
}
9999

100+
ALLOC2 (size: 8, align: 4) {
101+
01 00 00 00 00 00 00 00 │ ........
102+
}
103+
104+
ALLOC1 (size: 8, align: 4) {
105+
01 00 00 00 00 00 00 00 │ ........
106+
}
107+
108+
ALLOC0 (size: 8, align: 4) {
109+
01 00 00 00 00 00 00 00 │ ........
110+
}
111+

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@
7474
StorageDead(_7);
7575
StorageLive(_8);
7676
StorageLive(_9);
77-
_8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
78-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
77+
_8 = const {0x1 as *const [bool; 0]};
78+
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
7979
StorageDead(_9);
8080
StorageDead(_8);
8181
StorageDead(_6);
82-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
82+
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8383
StorageDead(_5);
84-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
84+
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8585
StorageDead(_4);
86-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
86+
_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);
8787
StorageDead(_3);
88-
_1 = A { foo: move _2 };
88+
_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) }};
8989
StorageDead(_2);
9090
_0 = const ();
9191
drop(_1) -> [return: bb1, unwind: bb2];
@@ -101,3 +101,15 @@
101101
}
102102
}
103103

104+
ALLOC2 (size: 8, align: 4) {
105+
01 00 00 00 00 00 00 00 │ ........
106+
}
107+
108+
ALLOC1 (size: 8, align: 4) {
109+
01 00 00 00 00 00 00 00 │ ........
110+
}
111+
112+
ALLOC0 (size: 8, align: 4) {
113+
01 00 00 00 00 00 00 00 │ ........
114+
}
115+

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@
7474
StorageDead(_7);
7575
StorageLive(_8);
7676
StorageLive(_9);
77-
_8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
78-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
77+
_8 = const {0x1 as *const [bool; 0]};
78+
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
7979
StorageDead(_9);
8080
StorageDead(_8);
8181
StorageDead(_6);
82-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
82+
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8383
StorageDead(_5);
84-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
84+
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8585
StorageDead(_4);
86-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
86+
_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);
8787
StorageDead(_3);
88-
_1 = A { foo: move _2 };
88+
_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) }};
8989
StorageDead(_2);
9090
_0 = const ();
9191
drop(_1) -> [return: bb1, unwind unreachable];
@@ -97,3 +97,15 @@
9797
}
9898
}
9999

100+
ALLOC2 (size: 16, align: 8) {
101+
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
102+
}
103+
104+
ALLOC1 (size: 16, align: 8) {
105+
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
106+
}
107+
108+
ALLOC0 (size: 16, align: 8) {
109+
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
110+
}
111+

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@
7474
StorageDead(_7);
7575
StorageLive(_8);
7676
StorageLive(_9);
77-
_8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
78-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
77+
_8 = const {0x1 as *const [bool; 0]};
78+
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
7979
StorageDead(_9);
8080
StorageDead(_8);
8181
StorageDead(_6);
82-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
82+
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8383
StorageDead(_5);
84-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
84+
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8585
StorageDead(_4);
86-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
86+
_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);
8787
StorageDead(_3);
88-
_1 = A { foo: move _2 };
88+
_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) }};
8989
StorageDead(_2);
9090
_0 = const ();
9191
drop(_1) -> [return: bb1, unwind: bb2];
@@ -101,3 +101,15 @@
101101
}
102102
}
103103

104+
ALLOC2 (size: 16, align: 8) {
105+
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
106+
}
107+
108+
ALLOC1 (size: 16, align: 8) {
109+
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
110+
}
111+
112+
ALLOC0 (size: 16, align: 8) {
113+
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
114+
}
115+

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,23 @@
7777
StorageLive(_8);
7878
StorageLive(_9);
7979
- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
80-
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
81-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
80+
- _5 = NonNull::<[bool; 0]> { pointer: _8 };
81+
+ _8 = const {0x1 as *const [bool; 0]};
82+
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
8283
StorageDead(_9);
8384
StorageDead(_8);
8485
StorageDead(_6);
85-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
86+
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
87+
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8688
StorageDead(_5);
87-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
89+
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
90+
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8891
StorageDead(_4);
89-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
92+
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
93+
+ _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);
9094
StorageDead(_3);
91-
_1 = A { foo: move _2 };
95+
- _1 = A { foo: move _2 };
96+
+ _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) }};
9297
StorageDead(_2);
9398
_0 = const ();
9499
drop(_1) -> [return: bb1, unwind unreachable];
@@ -98,5 +103,17 @@
98103
StorageDead(_1);
99104
return;
100105
}
106+
+ }
107+
+
108+
+ ALLOC2 (size: 8, align: 4) {
109+
+ 01 00 00 00 00 00 00 00 │ ........
110+
+ }
111+
+
112+
+ ALLOC1 (size: 8, align: 4) {
113+
+ 01 00 00 00 00 00 00 00 │ ........
114+
+ }
115+
+
116+
+ ALLOC0 (size: 8, align: 4) {
117+
+ 01 00 00 00 00 00 00 00 │ ........
101118
}
102119

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,23 @@
7777
StorageLive(_8);
7878
StorageLive(_9);
7979
- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
80-
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
81-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
80+
- _5 = NonNull::<[bool; 0]> { pointer: _8 };
81+
+ _8 = const {0x1 as *const [bool; 0]};
82+
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
8283
StorageDead(_9);
8384
StorageDead(_8);
8485
StorageDead(_6);
85-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
86+
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
87+
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8688
StorageDead(_5);
87-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
89+
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
90+
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8891
StorageDead(_4);
89-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
92+
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
93+
+ _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);
9094
StorageDead(_3);
91-
_1 = A { foo: move _2 };
95+
- _1 = A { foo: move _2 };
96+
+ _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) }};
9297
StorageDead(_2);
9398
_0 = const ();
9499
drop(_1) -> [return: bb1, unwind: bb2];
@@ -102,5 +107,17 @@
102107
bb2 (cleanup): {
103108
resume;
104109
}
110+
+ }
111+
+
112+
+ ALLOC2 (size: 8, align: 4) {
113+
+ 01 00 00 00 00 00 00 00 │ ........
114+
+ }
115+
+
116+
+ ALLOC1 (size: 8, align: 4) {
117+
+ 01 00 00 00 00 00 00 00 │ ........
118+
+ }
119+
+
120+
+ ALLOC0 (size: 8, align: 4) {
121+
+ 01 00 00 00 00 00 00 00 │ ........
105122
}
106123

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,23 @@
7777
StorageLive(_8);
7878
StorageLive(_9);
7979
- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
80-
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
81-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
80+
- _5 = NonNull::<[bool; 0]> { pointer: _8 };
81+
+ _8 = const {0x1 as *const [bool; 0]};
82+
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
8283
StorageDead(_9);
8384
StorageDead(_8);
8485
StorageDead(_6);
85-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
86+
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
87+
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8688
StorageDead(_5);
87-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
89+
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
90+
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8891
StorageDead(_4);
89-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
92+
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
93+
+ _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);
9094
StorageDead(_3);
91-
_1 = A { foo: move _2 };
95+
- _1 = A { foo: move _2 };
96+
+ _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) }};
9297
StorageDead(_2);
9398
_0 = const ();
9499
drop(_1) -> [return: bb1, unwind unreachable];
@@ -98,5 +103,17 @@
98103
StorageDead(_1);
99104
return;
100105
}
106+
+ }
107+
+
108+
+ ALLOC2 (size: 16, align: 8) {
109+
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
110+
+ }
111+
+
112+
+ ALLOC1 (size: 16, align: 8) {
113+
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
114+
+ }
115+
+
116+
+ ALLOC0 (size: 16, align: 8) {
117+
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
101118
}
102119

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,23 @@
7777
StorageLive(_8);
7878
StorageLive(_9);
7979
- _8 = _6 as *const [bool; 0] (PointerCoercion(MutToConstPointer));
80-
+ _8 = const {0x1 as *mut [bool; 0]} as *const [bool; 0] (PointerCoercion(MutToConstPointer));
81-
_5 = NonNull::<[bool; 0]> { pointer: _8 };
80+
- _5 = NonNull::<[bool; 0]> { pointer: _8 };
81+
+ _8 = const {0x1 as *const [bool; 0]};
82+
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
8283
StorageDead(_9);
8384
StorageDead(_8);
8485
StorageDead(_6);
85-
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
86+
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
87+
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
8688
StorageDead(_5);
87-
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
89+
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize));
90+
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
8891
StorageDead(_4);
89-
_2 = Box::<[bool]>(_3, const std::alloc::Global);
92+
- _2 = Box::<[bool]>(_3, const std::alloc::Global);
93+
+ _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);
9094
StorageDead(_3);
91-
_1 = A { foo: move _2 };
95+
- _1 = A { foo: move _2 };
96+
+ _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) }};
9297
StorageDead(_2);
9398
_0 = const ();
9499
drop(_1) -> [return: bb1, unwind: bb2];
@@ -102,5 +107,17 @@
102107
bb2 (cleanup): {
103108
resume;
104109
}
110+
+ }
111+
+
112+
+ ALLOC2 (size: 16, align: 8) {
113+
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
114+
+ }
115+
+
116+
+ ALLOC1 (size: 16, align: 8) {
117+
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
118+
+ }
119+
+
120+
+ ALLOC0 (size: 16, align: 8) {
121+
+ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
105122
}
106123

0 commit comments

Comments
 (0)