@@ -38,7 +38,9 @@ pub struct Validator {
3838impl < ' 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- 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) ;
4244 let mir_phase = self . mir_phase ;
4345
4446 let always_live_locals = AlwaysLiveLocals :: new ( body) ;
@@ -79,7 +81,6 @@ pub fn equal_up_to_regions(
7981 }
8082
8183 // Normalize lifetimes away on both sides, then compare.
82- let param_env = param_env. with_reveal_all_normalized ( tcx) ;
8384 let normalize = |ty : Ty < ' tcx > | {
8485 tcx. normalize_erasing_regions (
8586 param_env,
@@ -167,17 +168,14 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
167168 return true ;
168169 }
169170 // 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) ;
175173
176174 // Type-changing assignments can happen when subtyping is used. While
177175 // all normal lifetimes are erased, higher-ranked types with their
178176 // late-bound lifetimes are still around and can lead to type
179177 // 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)
181179 }
182180}
183181
@@ -357,9 +355,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
357355 }
358356 }
359357 TerminatorKind :: Call { func, args, destination, cleanup, .. } => {
360- let param_env = self . param_env . with_reveal_all_normalized ( self . tcx ) ;
361358 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) ;
363360 match func_ty. kind ( ) {
364361 ty:: FnPtr ( ..) | ty:: FnDef ( ..) => { }
365362 _ => self . fail (
0 commit comments