|
1 | 1 | // MIR for `main` after SimplifyCfg-elaborate-drops |
2 | 2 |
|
3 | 3 | fn main() -> () { |
4 | | - let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:11:11: 11:11 |
5 | | - let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14 |
6 | | - let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:14:25: 14:31 |
7 | | - let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:15:12: 15:29 |
8 | | - let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:26 |
9 | | - let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:7: 15:8 |
10 | | - let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:5: 15:9 |
11 | | - let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:15:5: 15:9 |
| 4 | + let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:12:11: 12:11 |
| 5 | + let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14 |
| 6 | + let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:31 |
| 7 | + let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:16:12: 16:29 |
| 8 | + let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:25: 16:26 |
| 9 | + let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:7: 16:8 |
| 10 | + let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9 |
| 11 | + let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9 |
12 | 12 | scope 1 { |
13 | | - debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:12:9: 12:14 |
14 | | - let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14 |
| 13 | + debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14 |
| 14 | + let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14 |
15 | 15 | scope 2 { |
16 | | - debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:13:9: 13:14 |
17 | | - let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:10 |
| 16 | + debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14 |
| 17 | + let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10 |
18 | 18 | scope 3 { |
19 | | - debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:14:9: 14:10 |
| 19 | + debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10 |
20 | 20 | scope 4 { |
21 | 21 | } |
22 | 22 | } |
23 | 23 | } |
24 | 24 | } |
25 | 25 |
|
26 | 26 | bb0: { |
27 | | - StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:12:9: 12:14 |
28 | | - _1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:12:17: 12:29 |
| 27 | + StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14 |
| 28 | + _1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29 |
29 | 29 | // ty::Const |
30 | 30 | // + ty: u32 |
31 | 31 | // + val: Value(Scalar(0x0000002a)) |
32 | 32 | // mir::Constant |
33 | | - // + span: $DIR/array-index-is-temporary.rs:12:18: 12:20 |
| 33 | + // + span: $DIR/array-index-is-temporary.rs:13:18: 13:20 |
34 | 34 | // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) } |
35 | 35 | // ty::Const |
36 | 36 | // + ty: u32 |
37 | 37 | // + val: Value(Scalar(0x0000002b)) |
38 | 38 | // mir::Constant |
39 | | - // + span: $DIR/array-index-is-temporary.rs:12:22: 12:24 |
| 39 | + // + span: $DIR/array-index-is-temporary.rs:13:22: 13:24 |
40 | 40 | // + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) } |
41 | 41 | // ty::Const |
42 | 42 | // + ty: u32 |
43 | 43 | // + val: Value(Scalar(0x0000002c)) |
44 | 44 | // mir::Constant |
45 | | - // + span: $DIR/array-index-is-temporary.rs:12:26: 12:28 |
| 45 | + // + span: $DIR/array-index-is-temporary.rs:13:26: 13:28 |
46 | 46 | // + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) } |
47 | | - StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14 |
48 | | - _2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:13:17: 13:18 |
| 47 | + StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14 |
| 48 | + _2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18 |
49 | 49 | // ty::Const |
50 | 50 | // + ty: usize |
51 | 51 | // + val: Value(Scalar(0x0000000000000001)) |
52 | 52 | // mir::Constant |
53 | | - // + span: $DIR/array-index-is-temporary.rs:13:17: 13:18 |
| 53 | + // + span: $DIR/array-index-is-temporary.rs:14:17: 14:18 |
54 | 54 | // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) } |
55 | | - StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:10 |
56 | | - StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31 |
57 | | - _4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31 |
58 | | - _3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:14:25: 14:31 |
59 | | - StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:14:31: 14:32 |
60 | | - StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:15:12: 15:29 |
61 | | - StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:15:25: 15:26 |
62 | | - _6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:15:25: 15:26 |
63 | | - _5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:15:21: 15:27 |
| 55 | + StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10 |
| 56 | + StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31 |
| 57 | + _4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31 |
| 58 | + _3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31 |
| 59 | + StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32 |
| 60 | + StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29 |
| 61 | + StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26 |
| 62 | + _6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26 |
| 63 | + _5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27 |
64 | 64 | // ty::Const |
65 | 65 | // + ty: unsafe fn(*mut usize) -> u32 {foo} |
66 | 66 | // + val: Value(Scalar(<ZST>)) |
67 | 67 | // mir::Constant |
68 | | - // + span: $DIR/array-index-is-temporary.rs:15:21: 15:24 |
| 68 | + // + span: $DIR/array-index-is-temporary.rs:16:21: 16:24 |
69 | 69 | // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) } |
70 | 70 | } |
71 | 71 |
|
72 | 72 | bb1: { |
73 | | - StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:15:26: 15:27 |
74 | | - StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:15:7: 15:8 |
75 | | - _7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:15:7: 15:8 |
76 | | - _8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9 |
77 | | - _9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9 |
78 | | - assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:9 |
| 73 | + StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27 |
| 74 | + StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8 |
| 75 | + _7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8 |
| 76 | + _8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9 |
| 77 | + _9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9 |
| 78 | + assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9 |
79 | 79 | } |
80 | 80 |
|
81 | 81 | bb2: { |
82 | | - _1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:15:5: 15:29 |
83 | | - StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:15:28: 15:29 |
84 | | - StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:15:29: 15:30 |
85 | | - _0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:11:11: 16:2 |
86 | | - StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:16:1: 16:2 |
87 | | - StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:16:1: 16:2 |
88 | | - StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:16:1: 16:2 |
89 | | - return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:16:2: 16:2 |
| 82 | + _1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29 |
| 83 | + StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29 |
| 84 | + StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30 |
| 85 | + _0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2 |
| 86 | + StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2 |
| 87 | + StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2 |
| 88 | + StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2 |
| 89 | + return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2 |
90 | 90 | } |
91 | 91 | } |
0 commit comments