@@ -309,21 +309,22 @@ fn check_terminator(
309
309
) -> McfResult {
310
310
let span = terminator. source_info . span ;
311
311
match & terminator. kind {
312
- TerminatorKind :: Goto { .. } | TerminatorKind :: Return | TerminatorKind :: Resume => Ok ( ( ) ) ,
312
+ TerminatorKind :: FalseEdges { .. }
313
+ | TerminatorKind :: FalseUnwind { .. }
314
+ | TerminatorKind :: Goto { .. }
315
+ | TerminatorKind :: Return
316
+ | TerminatorKind :: Resume => Ok ( ( ) ) ,
313
317
314
318
TerminatorKind :: Drop { location, .. } => check_place ( tcx, location, span, def_id, body) ,
315
319
TerminatorKind :: DropAndReplace { location, value, .. } => {
316
320
check_place ( tcx, location, span, def_id, body) ?;
317
321
check_operand ( tcx, value, span, def_id, body)
318
322
}
319
323
320
- TerminatorKind :: FalseEdges { .. } | TerminatorKind :: SwitchInt { .. }
321
- if !feature_allowed ( tcx, def_id, sym:: const_if_match) =>
322
- {
324
+ TerminatorKind :: SwitchInt { .. } if !feature_allowed ( tcx, def_id, sym:: const_if_match) => {
323
325
Err ( ( span, "loops and conditional expressions are not stable in const fn" . into ( ) ) )
324
326
}
325
327
326
- TerminatorKind :: FalseEdges { .. } => Ok ( ( ) ) ,
327
328
TerminatorKind :: SwitchInt { discr, switch_ty : _, values : _, targets : _ } => {
328
329
check_operand ( tcx, discr, span, def_id, body)
329
330
}
@@ -367,13 +368,5 @@ fn check_terminator(
367
368
TerminatorKind :: Assert { cond, expected : _, msg : _, target : _, cleanup : _ } => {
368
369
check_operand ( tcx, cond, span, def_id, body)
369
370
}
370
-
371
- TerminatorKind :: FalseUnwind { .. } if feature_allowed ( tcx, def_id, sym:: const_loop) => {
372
- Ok ( ( ) )
373
- }
374
-
375
- TerminatorKind :: FalseUnwind { .. } => {
376
- Err ( ( span, "loops are not allowed in const fn" . into ( ) ) )
377
- }
378
371
}
379
372
}
0 commit comments