validate: use the correct reveal during opts
This commit is contained in:
parent
f5418b09e8
commit
dd9d05cec4
2 changed files with 13 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_index::bit_set::BitSet;
|
use rustc_index::bit_set::BitSet;
|
||||||
|
use rustc_infer::traits::Reveal;
|
||||||
use rustc_middle::mir::interpret::Scalar;
|
use rustc_middle::mir::interpret::Scalar;
|
||||||
use rustc_middle::mir::visit::NonUseContext::VarDebugInfo;
|
use rustc_middle::mir::visit::NonUseContext::VarDebugInfo;
|
||||||
use rustc_middle::mir::visit::{PlaceContext, Visitor};
|
use rustc_middle::mir::visit::{PlaceContext, Visitor};
|
||||||
|
@ -44,8 +45,11 @@ impl<'tcx> MirPass<'tcx> for Validator {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let def_id = body.source.def_id();
|
let def_id = body.source.def_id();
|
||||||
let param_env = tcx.param_env(def_id);
|
|
||||||
let mir_phase = self.mir_phase;
|
let mir_phase = self.mir_phase;
|
||||||
|
let param_env = match mir_phase.reveal() {
|
||||||
|
Reveal::UserFacing => tcx.param_env(def_id),
|
||||||
|
Reveal::All => tcx.param_env_reveal_all_normalized(def_id),
|
||||||
|
};
|
||||||
|
|
||||||
let always_live_locals = always_storage_live_locals(body);
|
let always_live_locals = always_storage_live_locals(body);
|
||||||
let storage_liveness = MaybeStorageLive::new(always_live_locals)
|
let storage_liveness = MaybeStorageLive::new(always_live_locals)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
use super::{BasicBlock, Constant, Field, Local, SwitchTargets, UserTypeProjection};
|
use super::{BasicBlock, Constant, Field, Local, SwitchTargets, UserTypeProjection};
|
||||||
|
|
||||||
use crate::mir::coverage::{CodeRegion, CoverageKind};
|
use crate::mir::coverage::{CodeRegion, CoverageKind};
|
||||||
|
use crate::traits::Reveal;
|
||||||
use crate::ty::adjustment::PointerCast;
|
use crate::ty::adjustment::PointerCast;
|
||||||
use crate::ty::subst::SubstsRef;
|
use crate::ty::subst::SubstsRef;
|
||||||
use crate::ty::{self, List, Ty};
|
use crate::ty::{self, List, Ty};
|
||||||
|
@ -100,6 +101,13 @@ impl MirPhase {
|
||||||
MirPhase::Runtime(RuntimePhase::Optimized) => "runtime-optimized",
|
MirPhase::Runtime(RuntimePhase::Optimized) => "runtime-optimized",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn reveal(&self) -> Reveal {
|
||||||
|
match *self {
|
||||||
|
MirPhase::Built | MirPhase::Analysis(_) => Reveal::UserFacing,
|
||||||
|
MirPhase::Runtime(_) => Reveal::All,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`MirPhase::Analysis`].
|
/// See [`MirPhase::Analysis`].
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue