Skip to content

Commit 8247223

Browse files
committed
Revert "Always use param_env_reveal_all_normalized in validator"
This reverts commit 99be78d.
1 parent 675f114 commit 8247223

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

compiler/rustc_mir/src/transform/validate.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ pub struct Validator {
3838
impl<'tcx> MirPass<'tcx> for Validator {
3939
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
4040
let def_id = body.source.def_id();
41-
// We need to param_env_reveal_all_normalized, as some optimizations
42-
// change types in ways that require unfolding opaque types.
43-
let param_env = tcx.param_env_reveal_all_normalized(def_id);
41+
let param_env = tcx.param_env(def_id);
4442
let mir_phase = self.mir_phase;
4543

4644
let always_live_locals = AlwaysLiveLocals::new(body);
@@ -81,6 +79,7 @@ pub fn equal_up_to_regions(
8179
}
8280

8381
// Normalize lifetimes away on both sides, then compare.
82+
let param_env = param_env.with_reveal_all_normalized(tcx);
8483
let normalize = |ty: Ty<'tcx>| {
8584
tcx.normalize_erasing_regions(
8685
param_env,
@@ -168,14 +167,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
168167
return true;
169168
}
170169
// Normalize projections and things like that.
171-
let src = self.tcx.normalize_erasing_regions(self.param_env, src);
172-
let dest = self.tcx.normalize_erasing_regions(self.param_env, dest);
170+
// FIXME: We need to reveal_all, as some optimizations change types in ways
171+
// that require unfolding opaque types.
172+
let param_env = self.param_env.with_reveal_all_normalized(self.tcx);
173+
let src = self.tcx.normalize_erasing_regions(param_env, src);
174+
let dest = self.tcx.normalize_erasing_regions(param_env, dest);
173175

174176
// Type-changing assignments can happen when subtyping is used. While
175177
// all normal lifetimes are erased, higher-ranked types with their
176178
// late-bound lifetimes are still around and can lead to type
177179
// differences. So we compare ignoring lifetimes.
178-
equal_up_to_regions(self.tcx, self.param_env, src, dest)
180+
equal_up_to_regions(self.tcx, param_env, src, dest)
179181
}
180182
}
181183

@@ -362,8 +364,9 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
362364
}
363365
}
364366
TerminatorKind::Call { func, args, destination, cleanup, .. } => {
367+
let param_env = self.param_env.with_reveal_all_normalized(self.tcx);
365368
let func_ty = func.ty(&self.body.local_decls, self.tcx);
366-
let func_ty = self.tcx.normalize_erasing_regions(self.param_env, func_ty);
369+
let func_ty = self.tcx.normalize_erasing_regions(param_env, func_ty);
367370
match func_ty.kind() {
368371
ty::FnPtr(..) | ty::FnDef(..) => {}
369372
_ => self.fail(

0 commit comments

Comments
 (0)