]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
Rollup merge of #107344 - compiler-errors:new-solver-tweaks, r=lcnr
[rust.git] / tests / mir-opt / array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.mir
1 // MIR for `main` after SimplifyCfg-elaborate-drops
2
3 fn main() -> () {
4     let mut _0: ();                      // return place in scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +0:11
5     let mut _1: [u32; 3];                // in scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
6     let mut _4: &mut usize;              // in scope 0 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
7     let mut _5: u32;                     // in scope 0 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
8     let mut _6: *mut usize;              // in scope 0 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
9     let _7: usize;                       // in scope 0 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
10     let mut _8: usize;                   // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
11     let mut _9: bool;                    // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
12     scope 1 {
13         debug x => _1;                   // in scope 1 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
14         let mut _2: usize;               // in scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
15         scope 2 {
16             debug y => _2;               // in scope 2 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
17             let _3: *mut usize;          // in scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
18             scope 3 {
19                 debug z => _3;           // in scope 3 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
20                 scope 4 {
21                 }
22             }
23         }
24     }
25
26     bb0: {
27         StorageLive(_1);                 // scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
28         _1 = [const 42_u32, const 43_u32, const 44_u32]; // scope 0 at $DIR/array_index_is_temporary.rs:+1:17: +1:29
29         StorageLive(_2);                 // scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
30         _2 = const 1_usize;              // scope 1 at $DIR/array_index_is_temporary.rs:+2:17: +2:18
31         StorageLive(_3);                 // scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
32         StorageLive(_4);                 // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
33         _4 = &mut _2;                    // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
34         _3 = &raw mut (*_4);             // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
35         StorageDead(_4);                 // scope 2 at $DIR/array_index_is_temporary.rs:+3:31: +3:32
36         StorageLive(_5);                 // scope 3 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
37         StorageLive(_6);                 // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
38         _6 = _3;                         // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
39         _5 = foo(move _6) -> bb1;        // scope 4 at $DIR/array_index_is_temporary.rs:+4:21: +4:27
40                                          // mir::Constant
41                                          // + span: $DIR/array_index_is_temporary.rs:16:21: 16:24
42                                          // + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(<ZST>) }
43     }
44
45     bb1: {
46         StorageDead(_6);                 // scope 4 at $DIR/array_index_is_temporary.rs:+4:26: +4:27
47         StorageLive(_7);                 // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
48         _7 = _2;                         // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
49         _8 = Len(_1);                    // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
50         _9 = Lt(_7, _8);                 // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
51         assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
52     }
53
54     bb2: {
55         _1[_7] = move _5;                // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:29
56         StorageDead(_5);                 // scope 3 at $DIR/array_index_is_temporary.rs:+4:28: +4:29
57         StorageDead(_7);                 // scope 3 at $DIR/array_index_is_temporary.rs:+4:29: +4:30
58         _0 = const ();                   // scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +5:2
59         StorageDead(_3);                 // scope 2 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
60         StorageDead(_2);                 // scope 1 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
61         StorageDead(_1);                 // scope 0 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
62         return;                          // scope 0 at $DIR/array_index_is_temporary.rs:+5:2: +5:2
63     }
64 }