File tree 6 files changed +52
-19
lines changed
6 files changed +52
-19
lines changed Original file line number Diff line number Diff line change
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
+ // Issue 46036: [NLL] false edges on infinite loops
12
+ // Infinite loops should create false edges to the cleanup block.
13
+ #![ feature( nll) ]
14
+
15
+ struct Foo { x : & ' static u32 }
16
+
17
+ fn foo ( ) {
18
+ let a = 3 ;
19
+ let foo = Foo { x : & a } ; //~ ERROR E0597
20
+ loop { }
21
+ }
22
+
23
+ fn main ( ) { }
Original file line number Diff line number Diff line change @@ -46,17 +46,20 @@ fn main() {
46
46
// _3 = &'23_1rs _2;
47
47
// StorageLive(_5);
48
48
// _5 = _2;
49
- // switchInt(move _5) -> [0u8: bb3 , otherwise: bb2 ];
49
+ // switchInt(move _5) -> [0u8: bb4 , otherwise: bb3 ];
50
50
// }
51
51
// bb2: {
52
+ // ...
53
+ // }
54
+ // bb3: {
52
55
// _0 = ();
53
56
// StorageDead(_5);
54
57
// EndRegion('23_1rs);
55
58
// StorageDead(_3);
56
59
// StorageDead(_2);
57
60
// return;
58
61
// }
59
- // bb3 : {
62
+ // bb4 : {
60
63
// _4 = ();
61
64
// StorageDead(_5);
62
65
// StorageLive(_7);
@@ -67,6 +70,6 @@ fn main() {
67
70
// EndRegion('23_1rs);
68
71
// StorageDead(_3);
69
72
// StorageDead(_2);
70
- // goto -> bb1;
73
+ // falseUnwind -> [real: bb1, cleanup: bb2] ;
71
74
// }
72
75
// END rustc.main.SimplifyCfg-qualify-consts.after.mir
Original file line number Diff line number Diff line change @@ -48,17 +48,20 @@ fn main() {
48
48
// _3 = &'26_1rs _1;
49
49
// StorageLive(_5);
50
50
// _5 = _1;
51
- // switchInt(move _5) -> [0u8: bb3 , otherwise: bb2 ];
51
+ // switchInt(move _5) -> [0u8: bb4 , otherwise: bb3 ];
52
52
// }
53
53
// bb2: {
54
+ // ...
55
+ // }
56
+ // bb3: {
54
57
// _0 = ();
55
58
// StorageDead(_5);
56
59
// EndRegion('26_1rs);
57
60
// StorageDead(_3);
58
61
// StorageDead(_1);
59
62
// return;
60
63
// }
61
- // bb3 : {
64
+ // bb4 : {
62
65
// _4 = ();
63
66
// StorageDead(_5);
64
67
// StorageLive(_7);
@@ -68,6 +71,6 @@ fn main() {
68
71
// StorageDead(_7);
69
72
// EndRegion('26_1rs);
70
73
// StorageDead(_3);
71
- // goto -> bb1;
74
+ // falseUnwind -> [real: bb1, cleanup: bb2] ;
72
75
// }
73
76
// END rustc.main.SimplifyCfg-qualify-consts.after.mir
Original file line number Diff line number Diff line change @@ -58,15 +58,17 @@ fn main() {
58
58
// StorageLive(_2);
59
59
// _2 = const 3i32;
60
60
// StorageLive(_4);
61
- // goto -> bb1 ;
61
+ // goto -> bb2 ;
62
62
// }
63
- //
64
63
// bb1: {
64
+ // ...
65
+ // }
66
+ // bb2: {
65
67
// StorageLive(_7);
66
68
// _7 = _1;
67
- // switchInt(move _7) -> [0u8: bb3 , otherwise: bb2 ];
69
+ // switchInt(move _7) -> [0u8: bb4 , otherwise: bb3 ];
68
70
// }
69
- // bb2 : {
71
+ // bb3 : {
70
72
// _0 = ();
71
73
// StorageDead(_7);
72
74
// EndRegion('33_0rs);
@@ -75,13 +77,13 @@ fn main() {
75
77
// StorageDead(_1);
76
78
// return;
77
79
// }
78
- // bb3 : {
80
+ // bb4 : {
79
81
// _4 = &'33_0rs _2;
80
82
// _6 = ();
81
83
// StorageDead(_7);
82
84
// _1 = const true;
83
85
// _3 = ();
84
- // goto -> bb1;
86
+ // falseUnwind -> [real: bb2, cleanup: bb1] ;
85
87
// }
86
88
// }
87
89
// END rustc.main.SimplifyCfg-qualify-consts.after.mir
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ fn query() -> bool { true }
131
131
// _1 = ();
132
132
// EndRegion('35_0rs);
133
133
// StorageDead(_2);
134
- // goto -> bb1;
134
+ // falseUnwind -> [real: bb1, cleanup: bb2] ;
135
135
// }
136
136
// }
137
137
// END rustc.main.SimplifyCfg-qualify-consts.after.mir
Original file line number Diff line number Diff line change @@ -25,27 +25,29 @@ fn main() {
25
25
// bb0: {
26
26
// StorageLive(_1);
27
27
// _1 = const false;
28
- // goto -> bb1 ;
28
+ // goto -> bb2 ;
29
29
// }
30
30
//
31
31
// bb1: {
32
+ // resume;
33
+ // }
34
+ // bb2: {
32
35
// StorageLive(_4);
33
36
// _4 = _1;
34
- // switchInt(move _4) -> [0u8: bb3 , otherwise: bb2 ];
37
+ // switchInt(move _4) -> [0u8: bb4 , otherwise: bb3 ];
35
38
// }
36
- //
37
- // bb2: {
39
+ // bb3: {
38
40
// _0 = ();
39
41
// StorageDead(_4);
40
42
// StorageDead(_1);
41
43
// return;
42
44
// }
43
45
//
44
- // bb3 : {
46
+ // bb4 : {
45
47
// _3 = ();
46
48
// StorageDead(_4);
47
49
// _1 = const true;
48
50
// _2 = ();
49
- // goto -> bb1;
51
+ // falseUnwind -> [real: bb2, cleanup: bb1] ;
50
52
// }
51
53
// END rustc.main.SimplifyCfg-initial.after.mir
You can’t perform that action at this time.
0 commit comments