Skip to content

Commit bd2eccc

Browse files
committed
FIXME Revise end_region_4 test to try to make it sane. It still does not work though I think.
1 parent 9ddf7d0 commit bd2eccc

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

src/test/mir-opt/end_region_4.rs

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,60 @@
1111
// compile-flags: -Z identify_regions
1212
// ignore-tidy-linelength
1313

14-
struct D(i32);
15-
impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } }
14+
// Unwinding should EndRegion for in-scope borrows.
1615

1716
fn main() {
1817
let d = D(0);
19-
let a = 3;
18+
let a = 0;
2019
let b = &a;
2120
foo(*b);
2221
let c = &a;
2322
}
2423

24+
struct D(i32);
25+
impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } }
26+
2527
fn foo(i: i32) {
26-
if i > 3 { panic!("im positive"); }
28+
if i > 0 { panic!("im positive"); }
2729
}
2830

2931
// END RUST SOURCE
3032
// START rustc.node4.TypeckMir.before.mir
3133
// bb0: {
3234
// StorageLive(_1);
33-
// _1 = const 0usize;
34-
// StorageLive(_2);
35-
// _2 = &'14ce _1;
35+
// _1 = D::{{constructor}}(const 0i32,);
36+
// StorageLive(_3);
37+
// _3 = const 0i32;
38+
// StorageLive(_4);
39+
// _4 = &'21ce _3;
40+
// StorageLive(_6);
41+
// _6 = (*_4);
42+
// _5 = foo(_6) -> [return: bb3, unwind: bb2];
43+
// }
44+
//
45+
// bb1: {
46+
// resume;
47+
// }
48+
//
49+
// bb2: {
50+
// EndRegion('21ce);
51+
// drop(_1) -> bb1;
52+
// }
53+
//
54+
// bb3: {
55+
// StorageDead(_6);
56+
// StorageLive(_7);
57+
// _7 = &'33ce _3;
58+
// StorageDead(_7);
59+
// EndRegion('33ce);
60+
// StorageDead(_4);
61+
// EndRegion('21ce);
62+
// StorageDead(_3);
63+
// drop(_1) -> bb4;
64+
// }
65+
//
66+
// bb4: {
67+
// StorageDead(_1);
68+
// return;
3669
// }
3770
// END rustc.node4.TypeckMir.before.mir

0 commit comments

Comments
 (0)