Rollup merge of #129507 - RalfJung:per-fn-const_precise_live_drops, r=wesleywiser
make it possible to enable const_precise_live_drops per-function This makes const_precise_live_drops work with rustc_allow_const_fn_unstable so that we can stabilize individual functions that rely on const_precise_live_drops. The goal is that we can use that to stabilize some of https://github.com/rust-lang/rust/issues/67441 without having to stabilize const_precise_live_drops.
This commit is contained in:
commit
849c240c1e
3 changed files with 37 additions and 2 deletions
|
@ -9,13 +9,19 @@ use super::check::Qualifs;
|
|||
use super::ops::{self, NonConstOp};
|
||||
use super::qualifs::{NeedsNonConstDrop, Qualif};
|
||||
use super::ConstCx;
|
||||
use crate::check_consts::rustc_allow_const_fn_unstable;
|
||||
|
||||
/// Returns `true` if we should use the more precise live drop checker that runs after drop
|
||||
/// elaboration.
|
||||
pub fn checking_enabled(ccx: &ConstCx<'_, '_>) -> bool {
|
||||
// Const-stable functions must always use the stable live drop checker.
|
||||
// Const-stable functions must always use the stable live drop checker...
|
||||
if ccx.is_const_stable_const_fn() {
|
||||
return false;
|
||||
// ...except if they have the feature flag set via `rustc_allow_const_fn_unstable`.
|
||||
return rustc_allow_const_fn_unstable(
|
||||
ccx.tcx,
|
||||
ccx.body.source.def_id().expect_local(),
|
||||
sym::const_precise_live_drops,
|
||||
);
|
||||
}
|
||||
|
||||
ccx.tcx.features().const_precise_live_drops
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue