@@ -6,7 +6,7 @@ use rustc_hir::LangItem;
66use rustc_middle:: bug;
77use rustc_middle:: mir:: * ;
88use rustc_middle:: ty:: layout:: ValidityRequirement ;
9- use rustc_middle:: ty:: { self , GenericArgsRef , ParamEnv , Ty , TyCtxt , layout} ;
9+ use rustc_middle:: ty:: { self , GenericArgsRef , Ty , TyCtxt , layout} ;
1010use rustc_span:: sym;
1111use rustc_span:: symbol:: Symbol ;
1212
@@ -34,7 +34,7 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify {
3434 let ctx = InstSimplifyContext {
3535 tcx,
3636 local_decls : & body. local_decls ,
37- param_env : tcx . param_env_reveal_all_normalized ( body. source . def_id ( ) ) ,
37+ typing_env : body. typing_env ( tcx ) ,
3838 } ;
3939 let preserve_ub_checks =
4040 attr:: contains_name ( tcx. hir ( ) . krate_attrs ( ) , sym:: rustc_preserve_ub_checks) ;
@@ -66,13 +66,7 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify {
6666struct InstSimplifyContext < ' a , ' tcx > {
6767 tcx : TyCtxt < ' tcx > ,
6868 local_decls : & ' a LocalDecls < ' tcx > ,
69- param_env : ParamEnv < ' tcx > ,
70- }
71-
72- impl < ' tcx > InstSimplifyContext < ' _ , ' tcx > {
73- fn typing_env ( & self ) -> ty:: TypingEnv < ' tcx > {
74- ty:: TypingEnv { typing_mode : ty:: TypingMode :: PostAnalysis , param_env : self . param_env }
75- }
69+ typing_env : ty:: TypingEnv < ' tcx > ,
7670}
7771
7872impl < ' tcx > InstSimplifyContext < ' _ , ' tcx > {
@@ -354,7 +348,7 @@ impl<'tcx> InstSimplifyContext<'_, 'tcx> {
354348 }
355349
356350 let known_is_valid =
357- intrinsic_assert_panics ( self . tcx , self . typing_env ( ) , args[ 0 ] , intrinsic_name) ;
351+ intrinsic_assert_panics ( self . tcx , self . typing_env , args[ 0 ] , intrinsic_name) ;
358352 match known_is_valid {
359353 // We don't know the layout or it's not validity assertion at all, don't touch it
360354 None => { }
0 commit comments