1
Fork 0

switch allow_internal_unstable const fns to rustc_allow_const_fn_unstable

This commit is contained in:
Florian Warzecha 2020-10-21 20:54:20 +02:00
parent 3948b054dc
commit 05f4a9a42a
No known key found for this signature in database
GPG key ID: 4BE8C7D97F910C60
24 changed files with 81 additions and 39 deletions

View file

@ -87,7 +87,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
let is_feature_allowed = |feature_gate| {
// All features require that the corresponding gate be enabled,
// even if the function has `#[allow_internal_unstable(the_gate)]`.
// even if the function has `#[rustc_allow_const_fn_unstable(the_gate)]`.
if !tcx.features().enabled(feature_gate) {
return false;
}
@ -105,8 +105,8 @@ impl<'tcx> CheckConstVisitor<'tcx> {
}
// However, we cannot allow stable `const fn`s to use unstable features without an explicit
// opt-in via `allow_internal_unstable`.
attr::allow_internal_unstable(&tcx.sess, &tcx.get_attrs(def_id))
// opt-in via `rustc_allow_const_fn_unstable`.
attr::rustc_allow_const_fn_unstable(&tcx.sess, &tcx.get_attrs(def_id))
.map_or(false, |mut features| features.any(|name| name == feature_gate))
};