@@ -38,9 +38,7 @@ pub struct Validator {
38
38
impl < ' tcx > MirPass < ' tcx > for Validator {
39
39
fn run_pass ( & self , tcx : TyCtxt < ' tcx > , body : & mut Body < ' tcx > ) {
40
40
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) ;
44
42
let mir_phase = self . mir_phase ;
45
43
46
44
let always_live_locals = AlwaysLiveLocals :: new ( body) ;
@@ -81,6 +79,7 @@ pub fn equal_up_to_regions(
81
79
}
82
80
83
81
// Normalize lifetimes away on both sides, then compare.
82
+ let param_env = param_env. with_reveal_all_normalized ( tcx) ;
84
83
let normalize = |ty : Ty < ' tcx > | {
85
84
tcx. normalize_erasing_regions (
86
85
param_env,
@@ -168,14 +167,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
168
167
return true ;
169
168
}
170
169
// 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) ;
173
175
174
176
// Type-changing assignments can happen when subtyping is used. While
175
177
// all normal lifetimes are erased, higher-ranked types with their
176
178
// late-bound lifetimes are still around and can lead to type
177
179
// 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)
179
181
}
180
182
}
181
183
@@ -363,7 +365,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
363
365
}
364
366
TerminatorKind :: Call { func, args, destination, cleanup, .. } => {
365
367
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) ;
367
368
match func_ty. kind ( ) {
368
369
ty:: FnPtr ( ..) | ty:: FnDef ( ..) => { }
369
370
_ => self . fail (
0 commit comments