Keep an unoptimized duplicate of const fn around

This allows CTFE to reliably detect UB, as otherwise
optimizations may hide UB.
This commit is contained in:
oli 2020-10-26 19:00:40 +00:00 committed by oli
parent 8e4fe6647f
commit cccd40f9b5
25 changed files with 312 additions and 112 deletions

View file

@ -152,7 +152,7 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
if concrete.is_ok() && substs.has_param_types_or_consts() {
match infcx.tcx.def_kind(def.did) {
DefKind::AnonConst => {
let mir_body = infcx.tcx.optimized_mir_opt_const_arg(def);
let mir_body = infcx.tcx.mir_for_ctfe_opt_const_arg(def);
if mir_body.is_polymorphic {
future_compat_lint();