diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index 393ae9442a1..3df60993d9a 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -170,6 +170,10 @@ impl NonConstOp for LiveDrop { #[derive(Debug)] pub struct Loop; impl NonConstOp for Loop { + fn feature_gate(tcx: TyCtxt<'_>) -> Option { + Some(tcx.features().const_loop) + } + fn emit_error(&self, item: &Item<'_, '_>, span: Span) { // This should be caught by the HIR const-checker. item.tcx.sess.delay_span_bug( diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 1c95155e7ff..7d0abb5d463 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -390,8 +390,10 @@ fn check_terminator( cleanup: _, } => check_operand(tcx, cond, span, def_id, body), - TerminatorKind::FalseUnwind { .. } => { + TerminatorKind::FalseUnwind { .. } if !tcx.features().const_loop => { Err((span, "loops are not allowed in const fn".into())) }, + + TerminatorKind::FalseUnwind { .. } => Ok(()), } }