Skip to content

Commit 0294e3f

Browse files
committed
WIP crater experiment: do not promote const fn calls implicitly ever
1 parent 2987785 commit 0294e3f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

compiler/rustc_mir/src/transform/promote_consts.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -692,14 +692,9 @@ impl<'tcx> Validator<'_, 'tcx> {
692692
) -> Result<(), Unpromotable> {
693693
let fn_ty = callee.ty(self.body, self.tcx);
694694

695-
// When doing explicit promotion and inside const/static items, we promote all (eligible) function calls.
695+
// When doing explicit promotion, we promote all (eligible) function calls.
696696
// Everywhere else, we require `#[rustc_promotable]` on the callee.
697-
let promote_all_const_fn = self.explicit
698-
|| matches!(
699-
self.const_kind,
700-
Some(hir::ConstContext::Static(_) | hir::ConstContext::Const)
701-
);
702-
if !promote_all_const_fn {
697+
if !self.explicit {
703698
if let ty::FnDef(def_id, _) = *fn_ty.kind() {
704699
// Never promote runtime `const fn` calls of
705700
// functions without `#[rustc_promotable]`.

0 commit comments

Comments
 (0)