Prevent promotion of const fn calls in inline consts
This commit is contained in:
parent
44e199bf30
commit
9c762b58ba
15 changed files with 41 additions and 23 deletions
|
@ -167,7 +167,7 @@ impl<'mir, 'tcx> Qualifs<'mir, 'tcx> {
|
|||
false
|
||||
}
|
||||
|
||||
hir::ConstContext::Const | hir::ConstContext::Static(_) => {
|
||||
hir::ConstContext::Const { .. } | hir::ConstContext::Static(_) => {
|
||||
let mut cursor = FlowSensitiveAnalysis::new(CustomEq, ccx)
|
||||
.into_engine(ccx.tcx, &ccx.body)
|
||||
.iterate_to_fixpoint()
|
||||
|
|
|
@ -644,7 +644,7 @@ impl<'tcx> Validator<'_, 'tcx> {
|
|||
// Everywhere else, we require `#[rustc_promotable]` on the callee.
|
||||
let promote_all_const_fn = matches!(
|
||||
self.const_kind,
|
||||
Some(hir::ConstContext::Static(_) | hir::ConstContext::Const)
|
||||
Some(hir::ConstContext::Static(_) | hir::ConstContext::Const { inline: false })
|
||||
);
|
||||
if !promote_all_const_fn {
|
||||
if let ty::FnDef(def_id, _) = *fn_ty.kind() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue