@@ -38,7 +38,9 @@ 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
- let param_env = tcx. param_env ( 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) ;
42
44
let mir_phase = self . mir_phase ;
43
45
44
46
let always_live_locals = AlwaysLiveLocals :: new ( body) ;
@@ -79,7 +81,6 @@ pub fn equal_up_to_regions(
79
81
}
80
82
81
83
// Normalize lifetimes away on both sides, then compare.
82
- let param_env = param_env. with_reveal_all_normalized ( tcx) ;
83
84
let normalize = |ty : Ty < ' tcx > | {
84
85
tcx. normalize_erasing_regions (
85
86
param_env,
@@ -167,17 +168,14 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
167
168
return true ;
168
169
}
169
170
// Normalize projections and things like that.
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) ;
171
+ let src = self . tcx . normalize_erasing_regions ( self . param_env , src) ;
172
+ let dest = self . tcx . normalize_erasing_regions ( self . param_env , dest) ;
175
173
176
174
// Type-changing assignments can happen when subtyping is used. While
177
175
// all normal lifetimes are erased, higher-ranked types with their
178
176
// late-bound lifetimes are still around and can lead to type
179
177
// differences. So we compare ignoring lifetimes.
180
- equal_up_to_regions ( self . tcx , param_env, src, dest)
178
+ equal_up_to_regions ( self . tcx , self . param_env , src, dest)
181
179
}
182
180
}
183
181
@@ -357,9 +355,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
357
355
}
358
356
}
359
357
TerminatorKind :: Call { func, args, destination, cleanup, .. } => {
360
- let param_env = self . param_env . with_reveal_all_normalized ( self . tcx ) ;
361
358
let func_ty = func. ty ( & self . body . local_decls , self . tcx ) ;
362
- let func_ty = self . tcx . normalize_erasing_regions ( param_env, func_ty) ;
359
+ let func_ty = self . tcx . normalize_erasing_regions ( self . param_env , func_ty) ;
363
360
match func_ty. kind ( ) {
364
361
ty:: FnPtr ( ..) | ty:: FnDef ( ..) => { }
365
362
_ => self . fail (
0 commit comments