2020-04-02 21:09:01 +00:00
// MIR for `main` after SimplifyCfg-elaborate-drops
fn main ( ) -> ( ) {
2022-11-02 14:54:49 -07:00
let mut _0 : ( ) ; // return place in scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +0:11
let mut _1 : [ u32 ; 3 ] ; // in scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
let mut _4 : & mut usize ; // in scope 0 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
let mut _5 : u32 ; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
let mut _6 : * mut usize ; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
let _7 : usize ; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
let mut _8 : usize ; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
let mut _9 : bool ; // in scope 0 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
2020-04-02 21:09:01 +00:00
scope 1 {
2022-11-02 14:54:49 -07:00
debug x = > _1 ; // in scope 1 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
let mut _2 : usize ; // in scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
2020-04-02 21:09:01 +00:00
scope 2 {
2022-11-02 14:54:49 -07:00
debug y = > _2 ; // in scope 2 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
let _3 : * mut usize ; // in scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
2020-04-02 21:09:01 +00:00
scope 3 {
2022-11-02 14:54:49 -07:00
debug z = > _3 ; // in scope 3 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
2020-04-02 21:09:01 +00:00
scope 4 {
}
}
}
}
bb0 : {
2022-11-02 14:54:49 -07:00
StorageLive ( _1 ) ; // scope 0 at $DIR/array_index_is_temporary.rs:+1:9: +1:14
_1 = [ const 42_ u32 , const 43_ u32 , const 44_ u32 ] ; // scope 0 at $DIR/array_index_is_temporary.rs:+1:17: +1:29
StorageLive ( _2 ) ; // scope 1 at $DIR/array_index_is_temporary.rs:+2:9: +2:14
_2 = const 1_ usize ; // scope 1 at $DIR/array_index_is_temporary.rs:+2:17: +2:18
StorageLive ( _3 ) ; // scope 2 at $DIR/array_index_is_temporary.rs:+3:9: +3:10
StorageLive ( _4 ) ; // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
_4 = & mut _2 ; // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
_3 = & raw mut ( * _4 ) ; // scope 2 at $DIR/array_index_is_temporary.rs:+3:25: +3:31
StorageDead ( _4 ) ; // scope 2 at $DIR/array_index_is_temporary.rs:+3:31: +3:32
StorageLive ( _5 ) ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:12: +4:29
StorageLive ( _6 ) ; // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
_6 = _3 ; // scope 4 at $DIR/array_index_is_temporary.rs:+4:25: +4:26
2023-06-08 09:34:53 +02:00
_5 = foo ( move _6 ) -> [ return : bb1 , unwind unreachable ] ; // scope 4 at $DIR/array_index_is_temporary.rs:+4:21: +4:27
2020-04-02 21:09:01 +00:00
// mir::Constant
2023-04-05 09:44:20 +01:00
// + span: $DIR/array_index_is_temporary.rs:17:21: 17:24
2022-07-06 10:14:46 -04:00
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(<ZST>) }
2020-04-02 21:09:01 +00:00
}
bb1 : {
2022-11-02 14:54:49 -07:00
StorageDead ( _6 ) ; // scope 4 at $DIR/array_index_is_temporary.rs:+4:26: +4:27
StorageLive ( _7 ) ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
_7 = _2 ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:7: +4:8
_8 = Len ( _1 ) ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
_9 = Lt ( _7 , _8 ) ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
2023-06-08 09:34:53 +02:00
assert ( move _9 , " index out of bounds: the length is {} but the index is {} " , move _8 , _7 ) -> [ success : bb2 , unwind unreachable ] ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:9
2020-04-02 21:09:01 +00:00
}
bb2 : {
2022-11-02 14:54:49 -07:00
_1 [ _7 ] = move _5 ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:5: +4:29
StorageDead ( _5 ) ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:28: +4:29
StorageDead ( _7 ) ; // scope 3 at $DIR/array_index_is_temporary.rs:+4:29: +4:30
_0 = const ( ) ; // scope 0 at $DIR/array_index_is_temporary.rs:+0:11: +5:2
StorageDead ( _3 ) ; // scope 2 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
StorageDead ( _2 ) ; // scope 1 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
StorageDead ( _1 ) ; // scope 0 at $DIR/array_index_is_temporary.rs:+5:1: +5:2
return ; // scope 0 at $DIR/array_index_is_temporary.rs:+5:2: +5:2
2020-04-02 21:09:01 +00:00
}
}