Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ab64580

Browse files
committedSep 25, 2021
Bless tests
1 parent 19eaee2 commit ab64580

10 files changed

+342
-213
lines changed
 

‎src/test/mir-opt/box_expr.main.ElaborateDrops.before.mir

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,78 @@
33
fn main() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:6:11: 6:11
55
let _1: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:7:9: 7:10
6-
let mut _2: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:7:13: 7:25
7-
let _3: (); // in scope 0 at $DIR/box_expr.rs:8:5: 8:12
8-
let mut _4: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:8:10: 8:11
6+
let mut _2: usize; // in scope 0 at $DIR/box_expr.rs:7:13: 7:25
7+
let mut _3: usize; // in scope 0 at $DIR/box_expr.rs:7:13: 7:25
8+
let mut _4: *mut u8; // in scope 0 at $DIR/box_expr.rs:7:13: 7:25
9+
let mut _5: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:7:13: 7:25
10+
let _6: (); // in scope 0 at $DIR/box_expr.rs:8:5: 8:12
11+
let mut _7: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:8:10: 8:11
912
scope 1 {
1013
debug x => _1; // in scope 1 at $DIR/box_expr.rs:7:9: 7:10
1114
}
15+
scope 2 {
16+
}
1217

1318
bb0: {
1419
StorageLive(_1); // scope 0 at $DIR/box_expr.rs:7:9: 7:10
15-
StorageLive(_2); // scope 0 at $DIR/box_expr.rs:7:13: 7:25
16-
_2 = Box(S); // scope 0 at $DIR/box_expr.rs:7:13: 7:25
17-
(*_2) = S::new() -> [return: bb1, unwind: bb7]; // scope 0 at $DIR/box_expr.rs:7:17: 7:25
20+
_2 = SizeOf(S); // scope 2 at $DIR/box_expr.rs:7:13: 7:25
21+
_3 = AlignOf(S); // scope 2 at $DIR/box_expr.rs:7:13: 7:25
22+
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/box_expr.rs:7:13: 7:25
1823
// mir::Constant
19-
// + span: $DIR/box_expr.rs:7:17: 7:23
20-
// + literal: Const { ty: fn() -> S {S::new}, val: Value(Scalar(<ZST>)) }
24+
// + span: $DIR/box_expr.rs:7:13: 7:25
25+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
2126
}
2227

2328
bb1: {
24-
_1 = move _2; // scope 0 at $DIR/box_expr.rs:7:13: 7:25
25-
drop(_2) -> bb2; // scope 0 at $DIR/box_expr.rs:7:24: 7:25
29+
StorageLive(_5); // scope 0 at $DIR/box_expr.rs:7:13: 7:25
30+
_5 = ShallowInitBox(move _4, S); // scope 0 at $DIR/box_expr.rs:7:13: 7:25
31+
(*_5) = S::new() -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/box_expr.rs:7:17: 7:25
32+
// mir::Constant
33+
// + span: $DIR/box_expr.rs:7:17: 7:23
34+
// + literal: Const { ty: fn() -> S {S::new}, val: Value(Scalar(<ZST>)) }
2635
}
2736

2837
bb2: {
29-
StorageDead(_2); // scope 0 at $DIR/box_expr.rs:7:24: 7:25
30-
StorageLive(_3); // scope 1 at $DIR/box_expr.rs:8:5: 8:12
31-
StorageLive(_4); // scope 1 at $DIR/box_expr.rs:8:10: 8:11
32-
_4 = move _1; // scope 1 at $DIR/box_expr.rs:8:10: 8:11
33-
_3 = std::mem::drop::<Box<S>>(move _4) -> [return: bb3, unwind: bb5]; // scope 1 at $DIR/box_expr.rs:8:5: 8:12
38+
_1 = move _5; // scope 0 at $DIR/box_expr.rs:7:13: 7:25
39+
drop(_5) -> bb3; // scope 0 at $DIR/box_expr.rs:7:24: 7:25
40+
}
41+
42+
bb3: {
43+
StorageDead(_5); // scope 0 at $DIR/box_expr.rs:7:24: 7:25
44+
StorageLive(_6); // scope 1 at $DIR/box_expr.rs:8:5: 8:12
45+
StorageLive(_7); // scope 1 at $DIR/box_expr.rs:8:10: 8:11
46+
_7 = move _1; // scope 1 at $DIR/box_expr.rs:8:10: 8:11
47+
_6 = std::mem::drop::<Box<S>>(move _7) -> [return: bb4, unwind: bb6]; // scope 1 at $DIR/box_expr.rs:8:5: 8:12
3448
// mir::Constant
3549
// + span: $DIR/box_expr.rs:8:5: 8:9
3650
// + literal: Const { ty: fn(std::boxed::Box<S>) {std::mem::drop::<std::boxed::Box<S>>}, val: Value(Scalar(<ZST>)) }
3751
}
3852

39-
bb3: {
40-
StorageDead(_4); // scope 1 at $DIR/box_expr.rs:8:11: 8:12
41-
StorageDead(_3); // scope 1 at $DIR/box_expr.rs:8:12: 8:13
53+
bb4: {
54+
StorageDead(_7); // scope 1 at $DIR/box_expr.rs:8:11: 8:12
55+
StorageDead(_6); // scope 1 at $DIR/box_expr.rs:8:12: 8:13
4256
_0 = const (); // scope 0 at $DIR/box_expr.rs:6:11: 9:2
43-
drop(_1) -> bb4; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
57+
drop(_1) -> bb5; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
4458
}
4559

46-
bb4: {
60+
bb5: {
4761
StorageDead(_1); // scope 0 at $DIR/box_expr.rs:9:1: 9:2
4862
return; // scope 0 at $DIR/box_expr.rs:9:2: 9:2
4963
}
5064

51-
bb5 (cleanup): {
52-
drop(_4) -> bb6; // scope 1 at $DIR/box_expr.rs:8:11: 8:12
53-
}
54-
5565
bb6 (cleanup): {
56-
drop(_1) -> bb8; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
66+
drop(_7) -> bb7; // scope 1 at $DIR/box_expr.rs:8:11: 8:12
5767
}
5868

5969
bb7 (cleanup): {
60-
drop(_2) -> bb8; // scope 0 at $DIR/box_expr.rs:7:24: 7:25
70+
drop(_1) -> bb9; // scope 0 at $DIR/box_expr.rs:9:1: 9:2
6171
}
6272

6373
bb8 (cleanup): {
74+
drop(_5) -> bb9; // scope 0 at $DIR/box_expr.rs:7:24: 7:25
75+
}
76+
77+
bb9 (cleanup): {
6478
resume; // scope 0 at $DIR/box_expr.rs:6:1: 9:2
6579
}
6680
}

‎src/test/mir-opt/const_prop/boxes.main.ConstProp.diff

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,51 @@
66
let _1: i32; // in scope 0 at $DIR/boxes.rs:12:9: 12:10
77
let mut _2: i32; // in scope 0 at $DIR/boxes.rs:12:13: 12:22
88
let mut _3: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
9-
let mut _4: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
9+
let mut _4: usize; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
10+
let mut _5: usize; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
11+
let mut _6: *mut u8; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
12+
let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
1013
scope 1 {
1114
debug x => _1; // in scope 1 at $DIR/boxes.rs:12:9: 12:10
1215
}
16+
scope 2 {
17+
}
1318

1419
bb0: {
1520
StorageLive(_1); // scope 0 at $DIR/boxes.rs:12:9: 12:10
1621
StorageLive(_2); // scope 0 at $DIR/boxes.rs:12:13: 12:22
1722
StorageLive(_3); // scope 0 at $DIR/boxes.rs:12:14: 12:22
18-
StorageLive(_4); // scope 0 at $DIR/boxes.rs:12:14: 12:22
19-
_4 = Box(i32); // scope 0 at $DIR/boxes.rs:12:14: 12:22
20-
(*_4) = const 42_i32; // scope 0 at $DIR/boxes.rs:12:19: 12:21
21-
_3 = move _4; // scope 0 at $DIR/boxes.rs:12:14: 12:22
22-
StorageDead(_4); // scope 0 at $DIR/boxes.rs:12:21: 12:22
23+
- _4 = SizeOf(i32); // scope 2 at $DIR/boxes.rs:12:14: 12:22
24+
- _5 = AlignOf(i32); // scope 2 at $DIR/boxes.rs:12:14: 12:22
25+
- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> bb1; // scope 2 at $DIR/boxes.rs:12:14: 12:22
26+
+ _4 = const 4_usize; // scope 2 at $DIR/boxes.rs:12:14: 12:22
27+
+ _5 = const 4_usize; // scope 2 at $DIR/boxes.rs:12:14: 12:22
28+
+ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> bb1; // scope 2 at $DIR/boxes.rs:12:14: 12:22
29+
// mir::Constant
30+
// + span: $DIR/boxes.rs:12:14: 12:22
31+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
32+
}
33+
34+
bb1: {
35+
StorageLive(_7); // scope 0 at $DIR/boxes.rs:12:14: 12:22
36+
_7 = ShallowInitBox(move _6, i32); // scope 0 at $DIR/boxes.rs:12:14: 12:22
37+
(*_7) = const 42_i32; // scope 0 at $DIR/boxes.rs:12:19: 12:21
38+
_3 = move _7; // scope 0 at $DIR/boxes.rs:12:14: 12:22
39+
StorageDead(_7); // scope 0 at $DIR/boxes.rs:12:21: 12:22
2340
_2 = (*_3); // scope 0 at $DIR/boxes.rs:12:13: 12:22
2441
_1 = Add(move _2, const 0_i32); // scope 0 at $DIR/boxes.rs:12:13: 12:26
2542
StorageDead(_2); // scope 0 at $DIR/boxes.rs:12:25: 12:26
26-
drop(_3) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/boxes.rs:12:26: 12:27
43+
drop(_3) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/boxes.rs:12:26: 12:27
2744
}
2845

29-
bb1: {
46+
bb2: {
3047
StorageDead(_3); // scope 0 at $DIR/boxes.rs:12:26: 12:27
3148
nop; // scope 0 at $DIR/boxes.rs:11:11: 13:2
3249
StorageDead(_1); // scope 0 at $DIR/boxes.rs:13:1: 13:2
3350
return; // scope 0 at $DIR/boxes.rs:13:2: 13:2
3451
}
3552

36-
bb2 (cleanup): {
53+
bb3 (cleanup): {
3754
resume; // scope 0 at $DIR/boxes.rs:11:1: 13:2
3855
}
3956
}

‎src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,37 @@
44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:7:11: 7:11
66
let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
7-
let mut _2: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
8-
let mut _3: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
9-
+ let mut _4: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
7+
let mut _2: usize; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
8+
let mut _3: usize; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
9+
let mut _4: *mut u8; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
10+
let mut _5: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
11+
let mut _6: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
12+
+ let mut _7: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
1013
scope 1 {
1114
debug _x => _1; // in scope 1 at $DIR/inline-into-box-place.rs:8:9: 8:11
1215
}
13-
+ scope 2 (inlined Vec::<u32>::new) { // at $DIR/inline-into-box-place.rs:8:33: 8:43
16+
scope 2 {
17+
}
18+
+ scope 3 (inlined Vec::<u32>::new) { // at $DIR/inline-into-box-place.rs:8:33: 8:43
1419
+ }
1520

1621
bb0: {
1722
StorageLive(_1); // scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
18-
StorageLive(_2); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
19-
_2 = Box(std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
20-
- (*_2) = Vec::<u32>::new() -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
21-
+ StorageLive(_4); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
22-
+ _4 = &mut (*_2); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
23-
+ ((*_4).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 2 at $DIR/inline-into-box-place.rs:8:33: 8:43
23+
_2 = SizeOf(std::vec::Vec<u32>); // scope 2 at $DIR/inline-into-box-place.rs:8:29: 8:43
24+
_3 = AlignOf(std::vec::Vec<u32>); // scope 2 at $DIR/inline-into-box-place.rs:8:29: 8:43
25+
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/inline-into-box-place.rs:8:29: 8:43
26+
// mir::Constant
27+
// + span: $DIR/inline-into-box-place.rs:8:29: 8:43
28+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
29+
}
30+
31+
bb1: {
32+
StorageLive(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
33+
_5 = ShallowInitBox(move _4, std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
34+
- (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
35+
+ StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
36+
+ _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
37+
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
2438
+ // ty::Const
2539
+ // + ty: alloc::raw_vec::RawVec<u32>
2640
+ // + val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } })
@@ -30,32 +44,32 @@
3044
- // + literal: Const { ty: fn() -> std::vec::Vec<u32> {std::vec::Vec::<u32>::new}, val: Value(Scalar(<ZST>)) }
3145
- }
3246
-
33-
- bb1: {
47+
- bb2: {
3448
+ // + span: $DIR/inline-into-box-place.rs:8:33: 8:43
3549
+ // + user_ty: UserType(0)
3650
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [255], len: Size { raw: 8 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
37-
+ ((*_4).1: usize) = const 0_usize; // scope 2 at $DIR/inline-into-box-place.rs:8:33: 8:43
38-
+ StorageDead(_4); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
39-
_1 = move _2; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
40-
StorageDead(_2); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
51+
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
52+
+ StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
53+
_1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
54+
StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
4155
_0 = const (); // scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2
42-
- drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
43-
+ drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
56+
- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
57+
+ drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
4458
}
4559

46-
- bb2: {
47-
+ bb1: {
60+
- bb3: {
61+
+ bb2: {
4862
StorageDead(_1); // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
4963
return; // scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2
5064
}
5165

52-
- bb3 (cleanup): {
53-
+ bb2 (cleanup): {
66+
- bb4 (cleanup): {
67+
+ bb3 (cleanup): {
5468
resume; // scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2
5569
- }
5670
-
57-
- bb4 (cleanup): {
58-
- _3 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_2.1: std::alloc::Global)) -> bb3; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
71+
- bb5 (cleanup): {
72+
- _6 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_5.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
5973
- // mir::Constant
6074
- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43
6175
- // + literal: Const { ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>, std::alloc::Global) {alloc::alloc::box_free::<std::vec::Vec<u32>, std::alloc::Global>}, val: Value(Scalar(<ZST>)) }

‎src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,37 @@
44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:7:11: 7:11
66
let _1: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
7-
let mut _2: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
8-
let mut _3: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
9-
+ let mut _4: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
7+
let mut _2: usize; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
8+
let mut _3: usize; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
9+
let mut _4: *mut u8; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
10+
let mut _5: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
11+
let mut _6: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
12+
+ let mut _7: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
1013
scope 1 {
1114
debug _x => _1; // in scope 1 at $DIR/inline-into-box-place.rs:8:9: 8:11
1215
}
13-
+ scope 2 (inlined Vec::<u32>::new) { // at $DIR/inline-into-box-place.rs:8:33: 8:43
16+
scope 2 {
17+
}
18+
+ scope 3 (inlined Vec::<u32>::new) { // at $DIR/inline-into-box-place.rs:8:33: 8:43
1419
+ }
1520

1621
bb0: {
1722
StorageLive(_1); // scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
18-
StorageLive(_2); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
19-
_2 = Box(std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
20-
- (*_2) = Vec::<u32>::new() -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
21-
+ StorageLive(_4); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
22-
+ _4 = &mut (*_2); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
23-
+ ((*_4).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 2 at $DIR/inline-into-box-place.rs:8:33: 8:43
23+
_2 = SizeOf(std::vec::Vec<u32>); // scope 2 at $DIR/inline-into-box-place.rs:8:29: 8:43
24+
_3 = AlignOf(std::vec::Vec<u32>); // scope 2 at $DIR/inline-into-box-place.rs:8:29: 8:43
25+
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 2 at $DIR/inline-into-box-place.rs:8:29: 8:43
26+
// mir::Constant
27+
// + span: $DIR/inline-into-box-place.rs:8:29: 8:43
28+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
29+
}
30+
31+
bb1: {
32+
StorageLive(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
33+
_5 = ShallowInitBox(move _4, std::vec::Vec<u32>); // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
34+
- (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
35+
+ StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
36+
+ _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
37+
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
2438
+ // ty::Const
2539
+ // + ty: alloc::raw_vec::RawVec<u32>
2640
+ // + val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [65535], len: Size { raw: 16 } }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } })
@@ -30,32 +44,32 @@
3044
- // + literal: Const { ty: fn() -> std::vec::Vec<u32> {std::vec::Vec::<u32>::new}, val: Value(Scalar(<ZST>)) }
3145
- }
3246
-
33-
- bb1: {
47+
- bb2: {
3448
+ // + span: $DIR/inline-into-box-place.rs:8:33: 8:43
3549
+ // + user_ty: UserType(0)
3650
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [65535], len: Size { raw: 16 } }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
37-
+ ((*_4).1: usize) = const 0_usize; // scope 2 at $DIR/inline-into-box-place.rs:8:33: 8:43
38-
+ StorageDead(_4); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
39-
_1 = move _2; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
40-
StorageDead(_2); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
51+
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
52+
+ StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
53+
_1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
54+
StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
4155
_0 = const (); // scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2
42-
- drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
43-
+ drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
56+
- drop(_1) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
57+
+ drop(_1) -> [return: bb2, unwind: bb3]; // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
4458
}
4559

46-
- bb2: {
47-
+ bb1: {
60+
- bb3: {
61+
+ bb2: {
4862
StorageDead(_1); // scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
4963
return; // scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2
5064
}
5165

52-
- bb3 (cleanup): {
53-
+ bb2 (cleanup): {
66+
- bb4 (cleanup): {
67+
+ bb3 (cleanup): {
5468
resume; // scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2
5569
- }
5670
-
57-
- bb4 (cleanup): {
58-
- _3 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_2.1: std::alloc::Global)) -> bb3; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
71+
- bb5 (cleanup): {
72+
- _6 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_5.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_5.1: std::alloc::Global)) -> bb4; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
5973
- // mir::Constant
6074
- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43
6175
- // + literal: Const { ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>, std::alloc::Global) {alloc::alloc::box_free::<std::vec::Vec<u32>, std::alloc::Global>}, val: Value(Scalar(<ZST>)) }

‎src/test/mir-opt/issue_62289.test.ElaborateDrops.before.mir

Lines changed: 69 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,106 +3,120 @@
33
fn test() -> Option<Box<u32>> {
44
let mut _0: std::option::Option<std::boxed::Box<u32>>; // return place in scope 0 at $DIR/issue-62289.rs:8:14: 8:30
55
let mut _1: std::boxed::Box<u32>; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
6-
let mut _2: std::boxed::Box<u32>; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
7-
let mut _3: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:20
8-
let mut _4: std::option::Option<u32>; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:19
9-
let mut _5: isize; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
10-
let _6: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
11-
let mut _7: !; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
12-
let mut _8: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
13-
let _9: u32; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:20
6+
let mut _2: usize; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
7+
let mut _3: usize; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
8+
let mut _4: *mut u8; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
9+
let mut _5: std::boxed::Box<u32>; // in scope 0 at $DIR/issue-62289.rs:9:10: 9:21
10+
let mut _6: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, u32>; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:20
11+
let mut _7: std::option::Option<u32>; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:19
12+
let mut _8: isize; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
13+
let _9: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
14+
let mut _10: !; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
15+
let mut _11: std::option::Option<std::convert::Infallible>; // in scope 0 at $DIR/issue-62289.rs:9:19: 9:20
16+
let _12: u32; // in scope 0 at $DIR/issue-62289.rs:9:15: 9:20
1417
scope 1 {
15-
debug residual => _6; // in scope 1 at $DIR/issue-62289.rs:9:19: 9:20
16-
scope 2 {
18+
}
19+
scope 2 {
20+
debug residual => _9; // in scope 2 at $DIR/issue-62289.rs:9:19: 9:20
21+
scope 3 {
1722
}
1823
}
19-
scope 3 {
20-
debug val => _9; // in scope 3 at $DIR/issue-62289.rs:9:15: 9:20
21-
scope 4 {
24+
scope 4 {
25+
debug val => _12; // in scope 4 at $DIR/issue-62289.rs:9:15: 9:20
26+
scope 5 {
2227
}
2328
}
2429

2530
bb0: {
2631
StorageLive(_1); // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
27-
StorageLive(_2); // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
28-
_2 = Box(u32); // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
29-
StorageLive(_3); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
30-
StorageLive(_4); // scope 0 at $DIR/issue-62289.rs:9:15: 9:19
31-
_4 = Option::<u32>::None; // scope 0 at $DIR/issue-62289.rs:9:15: 9:19
32-
_3 = <Option<u32> as Try>::branch(move _4) -> [return: bb1, unwind: bb11]; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
32+
_2 = SizeOf(u32); // scope 1 at $DIR/issue-62289.rs:9:10: 9:21
33+
_3 = AlignOf(u32); // scope 1 at $DIR/issue-62289.rs:9:10: 9:21
34+
_4 = alloc::alloc::exchange_malloc(move _2, move _3) -> bb1; // scope 1 at $DIR/issue-62289.rs:9:10: 9:21
3335
// mir::Constant
34-
// + span: $DIR/issue-62289.rs:9:15: 9:20
35-
// + literal: Const { ty: fn(std::option::Option<u32>) -> std::ops::ControlFlow<<std::option::Option<u32> as std::ops::Try>::Residual, <std::option::Option<u32> as std::ops::Try>::Output> {<std::option::Option<u32> as std::ops::Try>::branch}, val: Value(Scalar(<ZST>)) }
36+
// + span: $DIR/issue-62289.rs:9:10: 9:21
37+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
3638
}
3739

3840
bb1: {
39-
StorageDead(_4); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
40-
_5 = discriminant(_3); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
41-
switchInt(move _5) -> [0_isize: bb2, 1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
41+
StorageLive(_5); // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
42+
_5 = ShallowInitBox(move _4, u32); // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
43+
StorageLive(_6); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
44+
StorageLive(_7); // scope 0 at $DIR/issue-62289.rs:9:15: 9:19
45+
_7 = Option::<u32>::None; // scope 0 at $DIR/issue-62289.rs:9:15: 9:19
46+
_6 = <Option<u32> as Try>::branch(move _7) -> [return: bb2, unwind: bb12]; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
47+
// mir::Constant
48+
// + span: $DIR/issue-62289.rs:9:15: 9:20
49+
// + literal: Const { ty: fn(std::option::Option<u32>) -> std::ops::ControlFlow<<std::option::Option<u32> as std::ops::Try>::Residual, <std::option::Option<u32> as std::ops::Try>::Output> {<std::option::Option<u32> as std::ops::Try>::branch}, val: Value(Scalar(<ZST>)) }
4250
}
4351

4452
bb2: {
45-
StorageLive(_9); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
46-
_9 = ((_3 as Continue).0: u32); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
47-
(*_2) = _9; // scope 4 at $DIR/issue-62289.rs:9:15: 9:20
48-
StorageDead(_9); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
49-
_1 = move _2; // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
50-
drop(_2) -> [return: bb6, unwind: bb10]; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
53+
StorageDead(_7); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
54+
_8 = discriminant(_6); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
55+
switchInt(move _8) -> [0_isize: bb3, 1_isize: bb5, otherwise: bb4]; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
5156
}
5257

5358
bb3: {
54-
unreachable; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
59+
StorageLive(_12); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
60+
_12 = ((_6 as Continue).0: u32); // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
61+
(*_5) = _12; // scope 5 at $DIR/issue-62289.rs:9:15: 9:20
62+
StorageDead(_12); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
63+
_1 = move _5; // scope 0 at $DIR/issue-62289.rs:9:10: 9:21
64+
drop(_5) -> [return: bb7, unwind: bb11]; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
5565
}
5666

5767
bb4: {
58-
StorageLive(_6); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
59-
_6 = ((_3 as Break).0: std::option::Option<std::convert::Infallible>); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
60-
StorageLive(_8); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
61-
_8 = _6; // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
62-
_0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _8) -> [return: bb5, unwind: bb11]; // scope 2 at $DIR/issue-62289.rs:9:15: 9:20
63-
// mir::Constant
64-
// + span: $DIR/issue-62289.rs:9:19: 9:20
65-
// + literal: Const { ty: fn(std::option::Option<std::convert::Infallible>) -> std::option::Option<std::boxed::Box<u32>> {<std::option::Option<std::boxed::Box<u32>> as std::ops::FromResidual<std::option::Option<std::convert::Infallible>>>::from_residual}, val: Value(Scalar(<ZST>)) }
68+
unreachable; // scope 0 at $DIR/issue-62289.rs:9:15: 9:20
6669
}
6770

6871
bb5: {
69-
StorageDead(_8); // scope 2 at $DIR/issue-62289.rs:9:19: 9:20
70-
StorageDead(_6); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
71-
drop(_2) -> bb8; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
72+
StorageLive(_9); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
73+
_9 = ((_6 as Break).0: std::option::Option<std::convert::Infallible>); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
74+
StorageLive(_11); // scope 3 at $DIR/issue-62289.rs:9:19: 9:20
75+
_11 = _9; // scope 3 at $DIR/issue-62289.rs:9:19: 9:20
76+
_0 = <Option<Box<u32>> as FromResidual<Option<Infallible>>>::from_residual(move _11) -> [return: bb6, unwind: bb12]; // scope 3 at $DIR/issue-62289.rs:9:15: 9:20
77+
// mir::Constant
78+
// + span: $DIR/issue-62289.rs:9:19: 9:20
79+
// + literal: Const { ty: fn(std::option::Option<std::convert::Infallible>) -> std::option::Option<std::boxed::Box<u32>> {<std::option::Option<std::boxed::Box<u32>> as std::ops::FromResidual<std::option::Option<std::convert::Infallible>>>::from_residual}, val: Value(Scalar(<ZST>)) }
7280
}
7381

7482
bb6: {
75-
StorageDead(_2); // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
76-
_0 = Option::<Box<u32>>::Some(move _1); // scope 0 at $DIR/issue-62289.rs:9:5: 9:22
77-
drop(_1) -> bb7; // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
83+
StorageDead(_11); // scope 3 at $DIR/issue-62289.rs:9:19: 9:20
84+
StorageDead(_9); // scope 0 at $DIR/issue-62289.rs:9:19: 9:20
85+
drop(_5) -> bb9; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
7886
}
7987

8088
bb7: {
81-
StorageDead(_1); // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
82-
StorageDead(_3); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
83-
goto -> bb9; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
89+
StorageDead(_5); // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
90+
_0 = Option::<Box<u32>>::Some(move _1); // scope 0 at $DIR/issue-62289.rs:9:5: 9:22
91+
drop(_1) -> bb8; // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
8492
}
8593

8694
bb8: {
87-
StorageDead(_2); // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
8895
StorageDead(_1); // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
89-
StorageDead(_3); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
90-
goto -> bb9; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
96+
StorageDead(_6); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
97+
goto -> bb10; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
9198
}
9299

93100
bb9: {
94-
return; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
101+
StorageDead(_5); // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
102+
StorageDead(_1); // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
103+
StorageDead(_6); // scope 0 at $DIR/issue-62289.rs:10:1: 10:2
104+
goto -> bb10; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
95105
}
96106

97-
bb10 (cleanup): {
98-
drop(_1) -> bb12; // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
107+
bb10: {
108+
return; // scope 0 at $DIR/issue-62289.rs:10:2: 10:2
99109
}
100110

101111
bb11 (cleanup): {
102-
drop(_2) -> bb12; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
112+
drop(_1) -> bb13; // scope 0 at $DIR/issue-62289.rs:9:21: 9:22
103113
}
104114

105115
bb12 (cleanup): {
116+
drop(_5) -> bb13; // scope 0 at $DIR/issue-62289.rs:9:20: 9:21
117+
}
118+
119+
bb13 (cleanup): {
106120
resume; // scope 0 at $DIR/issue-62289.rs:8:1: 10:2
107121
}
108122
}

‎src/test/mir-opt/uniform_array_move_out.move_out_by_subslice.mir_map.0.mir

Lines changed: 65 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,80 +4,108 @@ fn move_out_by_subslice() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:10:27: 10:27
55
let _1: [std::boxed::Box<i32>; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:11:9: 11:10
66
let mut _2: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
7-
let mut _3: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
8-
let mut _4: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
9-
let mut _5: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
7+
let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
8+
let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
9+
let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
10+
let mut _6: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
11+
let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
12+
let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
13+
let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
14+
let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
15+
let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
1016
scope 1 {
1117
debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:11:9: 11:10
12-
let _6: [std::boxed::Box<i32>; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
13-
scope 2 {
14-
debug _y => _6; // in scope 2 at $DIR/uniform_array_move_out.rs:12:10: 12:17
18+
let _12: [std::boxed::Box<i32>; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
19+
scope 4 {
20+
debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:12:10: 12:17
1521
}
1622
}
23+
scope 2 {
24+
}
25+
scope 3 {
26+
}
1727

1828
bb0: {
1929
StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:11:9: 11:10
2030
StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
21-
StorageLive(_3); // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
22-
_3 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
23-
(*_3) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
24-
_2 = move _3; // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
25-
drop(_3) -> [return: bb1, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
31+
_3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:11:14: 11:19
32+
_4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:11:14: 11:19
33+
_5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:11:14: 11:19
34+
// mir::Constant
35+
// + span: $DIR/uniform_array_move_out.rs:11:14: 11:19
36+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
2637
}
2738

2839
bb1: {
29-
StorageDead(_3); // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
30-
StorageLive(_4); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
31-
StorageLive(_5); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
32-
_5 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
33-
(*_5) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
34-
_4 = move _5; // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
35-
drop(_5) -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
40+
StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
41+
_6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
42+
(*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
43+
_2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:11:14: 11:19
44+
drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
3645
}
3746

3847
bb2: {
39-
StorageDead(_5); // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
40-
_1 = [move _2, move _4]; // scope 0 at $DIR/uniform_array_move_out.rs:11:13: 11:27
41-
drop(_4) -> [return: bb3, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
48+
StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:11:18: 11:19
49+
StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
50+
_8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:11:21: 11:26
51+
_9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:11:21: 11:26
52+
_10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:11:21: 11:26
53+
// mir::Constant
54+
// + span: $DIR/uniform_array_move_out.rs:11:21: 11:26
55+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
4256
}
4357

4458
bb3: {
45-
StorageDead(_4); // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
46-
drop(_2) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
59+
StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
60+
_11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
61+
(*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
62+
_7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:11:21: 11:26
63+
drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
4764
}
4865

4966
bb4: {
67+
StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:11:25: 11:26
68+
_1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:11:13: 11:27
69+
drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
70+
}
71+
72+
bb5: {
73+
StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
74+
drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
75+
}
76+
77+
bb6: {
5078
StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
5179
FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:11:9: 11:10
52-
StorageLive(_6); // scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
53-
_6 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
80+
StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
81+
_12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:12:10: 12:17
5482
_0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:10:27: 13:2
55-
drop(_6) -> [return: bb5, unwind: bb7]; // scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2
83+
drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2
5684
}
5785

58-
bb5: {
59-
StorageDead(_6); // scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2
60-
drop(_1) -> [return: bb6, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
86+
bb7: {
87+
StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:13:1: 13:2
88+
drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
6189
}
6290

63-
bb6: {
91+
bb8: {
6492
StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
6593
return; // scope 0 at $DIR/uniform_array_move_out.rs:13:2: 13:2
6694
}
6795

68-
bb7 (cleanup): {
69-
drop(_1) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
96+
bb9 (cleanup): {
97+
drop(_1) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:13:1: 13:2
7098
}
7199

72-
bb8 (cleanup): {
73-
drop(_4) -> bb9; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
100+
bb10 (cleanup): {
101+
drop(_7) -> bb11; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
74102
}
75103

76-
bb9 (cleanup): {
77-
drop(_2) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
104+
bb11 (cleanup): {
105+
drop(_2) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:11:26: 11:27
78106
}
79107

80-
bb10 (cleanup): {
108+
bb12 (cleanup): {
81109
resume; // scope 0 at $DIR/uniform_array_move_out.rs:10:1: 13:2
82110
}
83111
}

‎src/test/mir-opt/uniform_array_move_out.move_out_from_end.mir_map.0.mir

Lines changed: 65 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,80 +4,108 @@ fn move_out_from_end() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:4:24: 4:24
55
let _1: [std::boxed::Box<i32>; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:5:9: 5:10
66
let mut _2: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
7-
let mut _3: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
8-
let mut _4: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
9-
let mut _5: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
7+
let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
8+
let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
9+
let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
10+
let mut _6: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
11+
let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
12+
let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
13+
let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
14+
let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
15+
let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
1016
scope 1 {
1117
debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:5:9: 5:10
12-
let _6: std::boxed::Box<i32>; // in scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
13-
scope 2 {
14-
debug _y => _6; // in scope 2 at $DIR/uniform_array_move_out.rs:6:14: 6:16
18+
let _12: std::boxed::Box<i32>; // in scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
19+
scope 4 {
20+
debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:6:14: 6:16
1521
}
1622
}
23+
scope 2 {
24+
}
25+
scope 3 {
26+
}
1727

1828
bb0: {
1929
StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:5:9: 5:10
2030
StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
21-
StorageLive(_3); // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
22-
_3 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
23-
(*_3) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
24-
_2 = move _3; // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
25-
drop(_3) -> [return: bb1, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
31+
_3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:5:14: 5:19
32+
_4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:5:14: 5:19
33+
_5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:5:14: 5:19
34+
// mir::Constant
35+
// + span: $DIR/uniform_array_move_out.rs:5:14: 5:19
36+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
2637
}
2738

2839
bb1: {
29-
StorageDead(_3); // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
30-
StorageLive(_4); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
31-
StorageLive(_5); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
32-
_5 = Box(i32); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
33-
(*_5) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
34-
_4 = move _5; // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
35-
drop(_5) -> [return: bb2, unwind: bb8]; // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
40+
StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
41+
_6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
42+
(*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
43+
_2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:5:14: 5:19
44+
drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
3645
}
3746

3847
bb2: {
39-
StorageDead(_5); // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
40-
_1 = [move _2, move _4]; // scope 0 at $DIR/uniform_array_move_out.rs:5:13: 5:27
41-
drop(_4) -> [return: bb3, unwind: bb9]; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
48+
StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:5:18: 5:19
49+
StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
50+
_8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:5:21: 5:26
51+
_9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:5:21: 5:26
52+
_10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:5:21: 5:26
53+
// mir::Constant
54+
// + span: $DIR/uniform_array_move_out.rs:5:21: 5:26
55+
// + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(Scalar(<ZST>)) }
4256
}
4357

4458
bb3: {
45-
StorageDead(_4); // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
46-
drop(_2) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
59+
StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
60+
_11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
61+
(*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
62+
_7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:5:21: 5:26
63+
drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
4764
}
4865

4966
bb4: {
67+
StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:5:25: 5:26
68+
_1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:5:13: 5:27
69+
drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
70+
}
71+
72+
bb5: {
73+
StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
74+
drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
75+
}
76+
77+
bb6: {
5078
StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
5179
FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:5:9: 5:10
52-
StorageLive(_6); // scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
53-
_6 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
80+
StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
81+
_12 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:6:14: 6:16
5482
_0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:4:24: 7:2
55-
drop(_6) -> [return: bb5, unwind: bb7]; // scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2
83+
drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2
5684
}
5785

58-
bb5: {
59-
StorageDead(_6); // scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2
60-
drop(_1) -> [return: bb6, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
86+
bb7: {
87+
StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:7:1: 7:2
88+
drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
6189
}
6290

63-
bb6: {
91+
bb8: {
6492
StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
6593
return; // scope 0 at $DIR/uniform_array_move_out.rs:7:2: 7:2
6694
}
6795

68-
bb7 (cleanup): {
69-
drop(_1) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
96+
bb9 (cleanup): {
97+
drop(_1) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:7:1: 7:2
7098
}
7199

72-
bb8 (cleanup): {
73-
drop(_4) -> bb9; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
100+
bb10 (cleanup): {
101+
drop(_7) -> bb11; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
74102
}
75103

76-
bb9 (cleanup): {
77-
drop(_2) -> bb10; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
104+
bb11 (cleanup): {
105+
drop(_2) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:5:26: 5:27
78106
}
79107

80-
bb10 (cleanup): {
108+
bb12 (cleanup): {
81109
resume; // scope 0 at $DIR/uniform_array_move_out.rs:4:1: 7:2
82110
}
83111
}

‎src/test/ui/consts/miri_unleashed/box.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ fn main() {}
99
static TEST_BAD: &mut i32 = {
1010
&mut *(box 0)
1111
//~^ ERROR could not evaluate static initializer
12-
//~| NOTE heap allocations
12+
//~| NOTE calling non-const function `alloc::alloc::exchange_malloc`
1313
};

‎src/test/ui/consts/miri_unleashed/box.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
22
--> $DIR/box.rs:10:11
33
|
44
LL | &mut *(box 0)
5-
| ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants
5+
| ^^^^^^^ calling non-const function `alloc::alloc::exchange_malloc`
66

77
warning: skipping const checks
88
|

‎src/test/ui/nll/issue-52663-trait-object.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0597]: `tmp0` does not live long enough
44
LL | let tmp1 = &tmp0;
55
| ^^^^^ borrowed value does not live long enough
66
LL | box tmp1 as Box<dyn Foo + '_>
7-
| ----------------------------- borrow later captured here by trait object
7+
| ----------------------------- borrow later used here
88
LL | };
99
| - `tmp0` dropped here while still borrowed
1010

0 commit comments

Comments
 (0)
Please sign in to comment.