about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2021-10-04 13:58:17 -0700
committerGitHub <noreply@github.com>2021-10-04 13:58:17 -0700
commit9866b090f48fc5f45ca9c80618976e41987fc25d (patch)
tree2684f9670ab0a20213c782cf681e637d30095459 /compiler/rustc_const_eval/src
parent3d4467dfcc512fcb2dc2454c9cf77c23ff3de343 (diff)
parentbce86219830e386d1247364b6018ede2e85d3036 (diff)
downloadrust-9866b090f48fc5f45ca9c80618976e41987fc25d.tar.gz
rust-9866b090f48fc5f45ca9c80618976e41987fc25d.zip
Rollup merge of #89508 - jhpratt:stabilize-const_panic, r=joshtriplett
Stabilize `const_panic`

Closes #51999

FCP completed in #89006

```@rustbot``` label +A-const-eval +A-const-fn +T-lang

cc ```@oli-obk``` for review (not `r?`'ing as not on lang team)
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs2
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/ops.rs17
2 files changed, 0 insertions, 19 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index 57d92005a56..fd5cd269a3a 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -887,8 +887,6 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> {
 
                 // At this point, we are calling a function, `callee`, whose `DefId` is known...
                 if is_lang_panic_fn(tcx, callee) {
-                    self.check_op(ops::Panic);
-
                     // `begin_panic` and `panic_display` are generic functions that accept
                     // types other than str. Check to enforce that only str can be used in
                     // const-eval.
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
index a39fca0d8be..f08f51ec627 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
@@ -368,23 +368,6 @@ impl NonConstOp for MutDeref {
     }
 }
 
-#[derive(Debug)]
-pub struct Panic;
-impl NonConstOp for Panic {
-    fn status_in_item(&self, _: &ConstCx<'_, '_>) -> Status {
-        Status::Unstable(sym::const_panic)
-    }
-
-    fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
-        feature_err(
-            &ccx.tcx.sess.parse_sess,
-            sym::const_panic,
-            span,
-            &format!("panicking in {}s is unstable", ccx.const_kind()),
-        )
-    }
-}
-
 /// A call to a `panic()` lang item where the first argument is _not_ a `&str`.
 #[derive(Debug)]
 pub struct PanicNonStr;