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
}
}
- 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() {
issue = "none",
reason = "const_eval_select will never be stable"
)]
+#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
#[lang = "const_eval_select"]
#[rustc_do_not_const_check]
pub const unsafe fn const_eval_select<ARG, F, G, RET>(
issue = "none",
reason = "const_eval_select will never be stable"
)]
+#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
#[lang = "const_eval_select_ct"]
pub const unsafe fn const_eval_select_ct<ARG, F, G, RET>(
arg: ARG,
--- /dev/null
+#![feature(staged_api)]
+#![feature(const_eval_select)]
+#![stable(since = "1.0", feature = "ui_test")]
+
+use std::intrinsics::const_eval_select;
+
+fn log() {
+ println!("HEY HEY HEY")
+}
+
+const fn nothing(){}
+
+#[stable(since = "1.0", feature = "hey")]
+#[rustc_const_stable(since = "1.0", feature = "const_hey")]
+pub const unsafe fn hey() {
+ const_eval_select((), nothing, log);
+ //~^ ERROR `const_eval_select` is not yet stable as a const fn
+}
+
+fn main() {}
--- /dev/null
+error: `const_eval_select` is not yet stable as a const fn
+ --> $DIR/const-eval-select-stability.rs:16:5
+ |
+LL | const_eval_select((), nothing, log);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: const-stable functions can only call other const-stable functions
+
+error: aborting due to previous error
+