about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/transform/check_consts/ops.rs13
-rw-r--r--src/librustc_mir/transform/check_consts/validation.rs6
-rw-r--r--src/librustc_passes/check_const.rs13
3 files changed, 6 insertions, 26 deletions
diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs
index 814437faa58..ea025f208e4 100644
--- a/src/librustc_mir/transform/check_consts/ops.rs
+++ b/src/librustc_mir/transform/check_consts/ops.rs
@@ -165,19 +165,6 @@ impl NonConstOp for LiveDrop {
 }
 
 #[derive(Debug)]
-pub struct Loop;
-impl NonConstOp for Loop {
-    fn feature_gate() -> Option<Symbol> {
-        Some(sym::const_loop)
-    }
-
-    fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
-        // This should be caught by the HIR const-checker.
-        ccx.tcx.sess.delay_span_bug(span, "complex control flow is forbidden in a const context");
-    }
-}
-
-#[derive(Debug)]
 pub struct CellBorrow;
 impl NonConstOp for CellBorrow {
     fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs
index a10e3ee9372..ca1f0aecd04 100644
--- a/src/librustc_mir/transform/check_consts/validation.rs
+++ b/src/librustc_mir/transform/check_consts/validation.rs
@@ -207,12 +207,6 @@ impl Validator<'mir, 'tcx> {
             }
         }
 
-        if body.is_cfg_cyclic() {
-            // We can't provide a good span for the error here, but this should be caught by the
-            // HIR const-checker anyways.
-            self.check_op_spanned(ops::Loop, body.span);
-        }
-
         self.visit_body(&body);
 
         // Ensure that the end result is `Sync` in a non-thread local `static`.
diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs
index e3bb124e1e5..a385d96d974 100644
--- a/src/librustc_passes/check_const.rs
+++ b/src/librustc_passes/check_const.rs
@@ -40,18 +40,17 @@ impl NonConstExpr {
 
         let gates: &[_] = match self {
             // A `for` loop's desugaring contains a call to `IntoIterator::into_iter`,
-            // so they are not yet allowed with `#![feature(const_loop)]`.
+            // so they are not yet allowed.
             // Likewise, `?` desugars to a call to `Try::into_result`.
             Self::Loop(ForLoop) | Self::Match(ForLoopDesugar | TryDesugar | AwaitDesugar) => {
                 return None;
             }
 
-            Self::Loop(Loop | While | WhileLet) | Self::Match(WhileDesugar | WhileLetDesugar) => {
-                &[sym::const_loop]
-            }
-
-            // All other matches are allowed.
-            Self::Match(Normal | IfDesugar { .. } | IfLetDesugar { .. }) => &[],
+            // All other expressions are allowed.
+            Self::Loop(Loop | While | WhileLet)
+            | Self::Match(
+                WhileDesugar | WhileLetDesugar | Normal | IfDesugar { .. } | IfLetDesugar { .. },
+            ) => &[],
         };
 
         Some(gates)