diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-09-21 13:25:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-21 13:25:38 +0200 |
| commit | d05c5fecdec41d40ebf04a686b27019326525cb4 (patch) | |
| tree | e0d24dc0aa85091f82979d051aaf6ee1fdae032a /compiler/rustc_const_eval/src | |
| parent | 9ce64bae9415d0680f89137d705a06629b29fcae (diff) | |
| parent | 9c762b58ba9f46e806f7e07b80ef59b45de87471 (diff) | |
| download | rust-d05c5fecdec41d40ebf04a686b27019326525cb4.tar.gz rust-d05c5fecdec41d40ebf04a686b27019326525cb4.zip | |
Rollup merge of #115936 - oli-obk:inline_const_promotion, r=RalfJung
Prevent promotion of const fn calls in inline consts We don't wanna make that mistake we did for statics and consts worse by letting more code use it. r? ``@RalfJung`` cc https://github.com/rust-lang/rust/issues/76001
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/check_consts/check.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/promote_consts.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index f288ddc25d3..129e74425b6 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -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() diff --git a/compiler/rustc_const_eval/src/transform/promote_consts.rs b/compiler/rustc_const_eval/src/transform/promote_consts.rs index d79c65f1d1f..81168c31802 100644 --- a/compiler/rustc_const_eval/src/transform/promote_consts.rs +++ b/compiler/rustc_const_eval/src/transform/promote_consts.rs @@ -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() { |
