Clean up special function const checks
Mark them as const and `#[rustc_do_not_const_check]` instead of hard-coding them in const-eval checks.
This commit is contained in:
parent
235d9853d8
commit
cc4345a1c5
8 changed files with 53 additions and 87 deletions
|
@ -26,7 +26,7 @@ use rustc_index::vec::{Idx, IndexVec};
|
|||
use std::cell::Cell;
|
||||
use std::{cmp, iter, mem};
|
||||
|
||||
use crate::transform::check_consts::{is_lang_special_const_fn, qualifs, ConstCx};
|
||||
use crate::transform::check_consts::{qualifs, ConstCx};
|
||||
use crate::transform::MirPass;
|
||||
|
||||
/// A `MirPass` for promotion.
|
||||
|
@ -656,9 +656,7 @@ impl<'tcx> Validator<'_, 'tcx> {
|
|||
}
|
||||
|
||||
let is_const_fn = match *fn_ty.kind() {
|
||||
ty::FnDef(def_id, _) => {
|
||||
self.tcx.is_const_fn_raw(def_id) || is_lang_special_const_fn(self.tcx, def_id)
|
||||
}
|
||||
ty::FnDef(def_id, _) => self.tcx.is_const_fn_raw(def_id),
|
||||
_ => false,
|
||||
};
|
||||
if !is_const_fn {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue