Skip to content

Commit d43b9f3

Browse files
authored
Rollup merge of rust-lang#64100 - wesleywiser:fix_miri_const_eval, r=oli-obk
Fix const eval bug breaking run-pass tests in Miri PR rust-lang#63580 broke miri's ability to run the run-pass test suite with MIR optimizations enabled. The issue was that we weren't properly handling the substs and DefId associated with a Promoted value. This didn't break anything in rustc because in rustc this code runs before the Inliner pass which is where the DefId and substs can diverge from their initial values. It broke Miri though because it ran this code again after running the optimization pass. r? @oli-obk cc @RalfJung
2 parents 2f8cbfc + 46877e2 commit d43b9f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustc_mir/interpret/place.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,9 @@ where
585585
use rustc::mir::StaticKind;
586586

587587
Ok(match place_static.kind {
588-
StaticKind::Promoted(promoted, _) => {
589-
let instance = self.frame().instance;
588+
StaticKind::Promoted(promoted, promoted_substs) => {
589+
let substs = self.subst_from_frame_and_normalize_erasing_regions(promoted_substs);
590+
let instance = ty::Instance::new(place_static.def_id, substs);
590591
self.const_eval_raw(GlobalId {
591592
instance,
592593
promoted: Some(promoted),

0 commit comments

Comments
 (0)