@@ -309,21 +309,22 @@ fn check_terminator(
309309) -> McfResult {
310310 let span = terminator. source_info . span ;
311311 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 ( ( ) ) ,
313317
314318 TerminatorKind :: Drop { location, .. } => check_place ( tcx, location, span, def_id, body) ,
315319 TerminatorKind :: DropAndReplace { location, value, .. } => {
316320 check_place ( tcx, location, span, def_id, body) ?;
317321 check_operand ( tcx, value, span, def_id, body)
318322 }
319323
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) => {
323325 Err ( ( span, "loops and conditional expressions are not stable in const fn" . into ( ) ) )
324326 }
325327
326- TerminatorKind :: FalseEdges { .. } => Ok ( ( ) ) ,
327328 TerminatorKind :: SwitchInt { discr, switch_ty : _, values : _, targets : _ } => {
328329 check_operand ( tcx, discr, span, def_id, body)
329330 }
@@ -367,13 +368,5 @@ fn check_terminator(
367368 TerminatorKind :: Assert { cond, expected : _, msg : _, target : _, cleanup : _ } => {
368369 check_operand ( tcx, cond, span, def_id, body)
369370 }
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- }
378371 }
379372}
0 commit comments