@@ -13,7 +13,7 @@ use rustc_span::def_id::DefId;
13
13
14
14
enum EdgeKind {
15
15
Unwind ,
16
- Other ,
16
+ Normal ,
17
17
}
18
18
19
19
pub struct Validator {
@@ -59,11 +59,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
59
59
let src = self . body . basic_blocks ( ) . get ( location. block ) . unwrap ( ) ;
60
60
match ( src. is_cleanup , bb. is_cleanup , edge_kind) {
61
61
// Non-cleanup blocks can jump to non-cleanup blocks along non-unwind edges
62
- ( false , false , EdgeKind :: Other )
62
+ ( false , false , EdgeKind :: Normal )
63
63
// Non-cleanup blocks can jump to cleanup blocks along unwind edges
64
64
| ( false , true , EdgeKind :: Unwind )
65
- // Cleanup blocks can jump to cleanup blocks along any edges
66
- | ( true , true , _ ) => { }
65
+ // Cleanup blocks can jump to cleanup blocks along non-unwind edges
66
+ | ( true , true , EdgeKind :: Normal ) => { }
67
67
// All other jumps are invalid
68
68
_ => {
69
69
self . fail (
@@ -114,7 +114,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
114
114
fn visit_terminator ( & mut self , terminator : & Terminator < ' tcx > , location : Location ) {
115
115
match & terminator. kind {
116
116
TerminatorKind :: Goto { target } => {
117
- self . check_bb ( location, * target, EdgeKind :: Other ) ;
117
+ self . check_bb ( location, * target, EdgeKind :: Normal ) ;
118
118
}
119
119
TerminatorKind :: SwitchInt { targets, values, .. } => {
120
120
if targets. len ( ) != values. len ( ) + 1 {
@@ -128,17 +128,17 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
128
128
) ;
129
129
}
130
130
for target in targets {
131
- self . check_bb ( location, * target, EdgeKind :: Other ) ;
131
+ self . check_bb ( location, * target, EdgeKind :: Normal ) ;
132
132
}
133
133
}
134
134
TerminatorKind :: Drop { target, unwind, .. } => {
135
- self . check_bb ( location, * target, EdgeKind :: Other ) ;
135
+ self . check_bb ( location, * target, EdgeKind :: Normal ) ;
136
136
if let Some ( unwind) = unwind {
137
137
self . check_bb ( location, * unwind, EdgeKind :: Unwind ) ;
138
138
}
139
139
}
140
140
TerminatorKind :: DropAndReplace { target, unwind, .. } => {
141
- self . check_bb ( location, * target, EdgeKind :: Other ) ;
141
+ self . check_bb ( location, * target, EdgeKind :: Normal ) ;
142
142
if let Some ( unwind) = unwind {
143
143
self . check_bb ( location, * unwind, EdgeKind :: Unwind ) ;
144
144
}
@@ -153,7 +153,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
153
153
) ,
154
154
}
155
155
if let Some ( ( _, target) ) = destination {
156
- self . check_bb ( location, * target, EdgeKind :: Other ) ;
156
+ self . check_bb ( location, * target, EdgeKind :: Normal ) ;
157
157
}
158
158
if let Some ( cleanup) = cleanup {
159
159
self . check_bb ( location, * cleanup, EdgeKind :: Unwind ) ;
@@ -170,30 +170,30 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
170
170
) ,
171
171
) ;
172
172
}
173
- self . check_bb ( location, * target, EdgeKind :: Other ) ;
173
+ self . check_bb ( location, * target, EdgeKind :: Normal ) ;
174
174
if let Some ( cleanup) = cleanup {
175
175
self . check_bb ( location, * cleanup, EdgeKind :: Unwind ) ;
176
176
}
177
177
}
178
178
TerminatorKind :: Yield { resume, drop, .. } => {
179
- self . check_bb ( location, * resume, EdgeKind :: Other ) ;
179
+ self . check_bb ( location, * resume, EdgeKind :: Normal ) ;
180
180
if let Some ( drop) = drop {
181
- self . check_bb ( location, * drop, EdgeKind :: Other ) ;
181
+ self . check_bb ( location, * drop, EdgeKind :: Normal ) ;
182
182
}
183
183
}
184
184
TerminatorKind :: FalseEdge { real_target, imaginary_target } => {
185
- self . check_bb ( location, * real_target, EdgeKind :: Other ) ;
186
- self . check_bb ( location, * imaginary_target, EdgeKind :: Other ) ;
185
+ self . check_bb ( location, * real_target, EdgeKind :: Normal ) ;
186
+ self . check_bb ( location, * imaginary_target, EdgeKind :: Normal ) ;
187
187
}
188
188
TerminatorKind :: FalseUnwind { real_target, unwind } => {
189
- self . check_bb ( location, * real_target, EdgeKind :: Other ) ;
189
+ self . check_bb ( location, * real_target, EdgeKind :: Normal ) ;
190
190
if let Some ( unwind) = unwind {
191
191
self . check_bb ( location, * unwind, EdgeKind :: Unwind ) ;
192
192
}
193
193
}
194
194
TerminatorKind :: InlineAsm { destination, .. } => {
195
195
if let Some ( destination) = destination {
196
- self . check_bb ( location, * destination, EdgeKind :: Other ) ;
196
+ self . check_bb ( location, * destination, EdgeKind :: Normal ) ;
197
197
}
198
198
}
199
199
// Nothing to validate for these.
0 commit comments