]>
Commit | Line | Data |
---|---|---|
3b2f2976 XL |
1 | // Copyright 2017 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // ignore-tidy-linelength | |
12 | // compile-flags: -Z verbose -Z mir-emit-validate=1 | |
13 | ||
14 | struct Test { | |
15 | x: i32 | |
16 | } | |
17 | ||
18 | fn foo(_x: &i32) {} | |
19 | ||
20 | fn main() { | |
21 | // These internal unsafe functions should have no effect on the code generation. | |
22 | unsafe fn _unused1() {} | |
23 | fn _unused2(x: *const i32) -> i32 { unsafe { *x }} | |
24 | ||
25 | let t = Test { x: 0 }; | |
26 | let t = &t; | |
27 | foo(&t.x); | |
28 | } | |
29 | ||
30 | // END RUST SOURCE | |
abe05a73 | 31 | // START rustc.main.EraseRegions.after.mir |
3b2f2976 | 32 | // fn main() -> () { |
abe05a73 | 33 | // ... |
3b2f2976 XL |
34 | // let mut _5: &ReErased i32; |
35 | // bb0: { | |
abe05a73 XL |
36 | // StorageLive(_1); |
37 | // _1 = Test { x: const 0i32 }; | |
38 | // StorageLive(_2); | |
39 | // Validate(Suspend(ReScope(Remainder(BlockRemainder { block: ItemLocalId(19), first_statement_index: 3 }))), [_1: Test]); | |
40 | // _2 = &ReErased _1; | |
41 | // Validate(Acquire, [(*_2): Test/ReScope(Remainder(BlockRemainder { block: ItemLocalId(19), first_statement_index: 3 })) (imm)]); | |
42 | // StorageLive(_4); | |
43 | // StorageLive(_5); | |
ea8adc8c | 44 | // Validate(Suspend(ReScope(Node(ItemLocalId(17)))), [((*_2).0: i32): i32/ReScope(Remainder(BlockRemainder { block: ItemLocalId(19), first_statement_index: 3 })) (imm)]); |
3b2f2976 | 45 | // _5 = &ReErased ((*_2).0: i32); |
ea8adc8c XL |
46 | // Validate(Acquire, [(*_5): i32/ReScope(Node(ItemLocalId(17))) (imm)]); |
47 | // Validate(Suspend(ReScope(Node(ItemLocalId(17)))), [(*_5): i32/ReScope(Node(ItemLocalId(17))) (imm)]); | |
3b2f2976 | 48 | // _4 = &ReErased (*_5); |
ea8adc8c XL |
49 | // Validate(Acquire, [(*_4): i32/ReScope(Node(ItemLocalId(17))) (imm)]); |
50 | // Validate(Release, [_3: (), _4: &ReScope(Node(ItemLocalId(17))) i32]); | |
3b2f2976 XL |
51 | // _3 = const foo(_4) -> bb1; |
52 | // } | |
53 | // bb1: { | |
abe05a73 | 54 | // Validate(Acquire, [_3: ()]); |
ea8adc8c | 55 | // EndRegion(ReScope(Node(ItemLocalId(17)))); |
abe05a73 XL |
56 | // StorageDead(_4); |
57 | // StorageDead(_5); | |
58 | // _0 = (); | |
ea8adc8c | 59 | // EndRegion(ReScope(Remainder(BlockRemainder { block: ItemLocalId(19), first_statement_index: 3 }))); |
abe05a73 XL |
60 | // StorageDead(_2); |
61 | // StorageDead(_1); | |
3b2f2976 XL |
62 | // return; |
63 | // } | |
64 | // } | |
abe05a73 | 65 | // END rustc.main.EraseRegions.after.mir |