From 26b78ccd317d7950e0aa9861c7c8e643d92d77cf Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Thu, 14 Oct 2021 06:53:20 +0000 Subject: Fix const stability --- compiler/rustc_const_eval/src/transform/check_consts/check.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_const_eval/src') 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 22f14ffbd58..d704c4335c7 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -24,7 +24,7 @@ use std::ops::Deref; use super::ops::{self, NonConstOp, Status}; use super::qualifs::{self, CustomEq, HasMutInterior, NeedsNonConstDrop}; use super::resolver::FlowSensitiveAnalysis; -use super::{is_lang_special_const_fn, ConstCx, Qualif}; +use super::{is_lang_panic_fn, is_lang_special_const_fn, ConstCx, Qualif}; use crate::const_eval::is_unstable_const_fn; // We are using `MaybeMutBorrowedLocals` as a proxy for whether an item may have been mutated @@ -910,7 +910,10 @@ impl Visitor<'tcx> for Checker<'mir, 'tcx> { } } - return; + if is_lang_panic_fn(tcx, callee) { + // run stability check on non-panic special const fns. + return; + } } if Some(callee) == tcx.lang_items().exchange_malloc_fn() { -- cgit 1.4.1-3-g733a5