Use ParamEnv consistently
This commit is contained in:
parent
de69d088a4
commit
efc7ca8c7d
1 changed files with 8 additions and 9 deletions
|
@ -217,11 +217,12 @@ impl<'tcx> std::fmt::Debug for ScalarTy<'tcx> {
|
||||||
|
|
||||||
impl<'tcx> ConstAnalysis<'tcx> {
|
impl<'tcx> ConstAnalysis<'tcx> {
|
||||||
pub fn new(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, map: Map) -> Self {
|
pub fn new(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, map: Map) -> Self {
|
||||||
|
let param_env = tcx.param_env(body.source.def_id());
|
||||||
Self {
|
Self {
|
||||||
map,
|
map,
|
||||||
tcx,
|
tcx,
|
||||||
ecx: InterpCx::new(tcx, DUMMY_SP, ty::ParamEnv::empty(), DummyMachine),
|
ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine),
|
||||||
param_env: tcx.param_env(body.source.def_id()),
|
param_env: param_env,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,13 +261,11 @@ impl<'tcx> ConstAnalysis<'tcx> {
|
||||||
};
|
};
|
||||||
match value {
|
match value {
|
||||||
FlatSet::Top => FlatSet::Top,
|
FlatSet::Top => FlatSet::Top,
|
||||||
FlatSet::Elem(ScalarTy(scalar, ty)) => {
|
FlatSet::Elem(ScalarTy(scalar, ty)) => self
|
||||||
let layout = self
|
.tcx
|
||||||
.tcx
|
.layout_of(self.param_env.and(ty))
|
||||||
.layout_of(ty::ParamEnv::empty().and(ty))
|
.map(|layout| FlatSet::Elem(ImmTy::from_scalar(scalar, layout)))
|
||||||
.expect("this should not happen"); // FIXME
|
.unwrap_or(FlatSet::Top),
|
||||||
FlatSet::Elem(ImmTy::from_scalar(scalar, layout))
|
|
||||||
}
|
|
||||||
FlatSet::Bottom => FlatSet::Bottom,
|
FlatSet::Bottom => FlatSet::Bottom,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue