@@ -6,7 +6,7 @@ use rustc_hir::LangItem;
6
6
use rustc_middle:: bug;
7
7
use rustc_middle:: mir:: * ;
8
8
use 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} ;
10
10
use rustc_span:: sym;
11
11
use rustc_span:: symbol:: Symbol ;
12
12
@@ -34,7 +34,7 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify {
34
34
let ctx = InstSimplifyContext {
35
35
tcx,
36
36
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 ) ,
38
38
} ;
39
39
let preserve_ub_checks =
40
40
attr:: contains_name ( tcx. hir ( ) . krate_attrs ( ) , sym:: rustc_preserve_ub_checks) ;
@@ -66,13 +66,7 @@ impl<'tcx> crate::MirPass<'tcx> for InstSimplify {
66
66
struct InstSimplifyContext < ' a , ' tcx > {
67
67
tcx : TyCtxt < ' tcx > ,
68
68
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 > ,
76
70
}
77
71
78
72
impl < ' tcx > InstSimplifyContext < ' _ , ' tcx > {
@@ -354,7 +348,7 @@ impl<'tcx> InstSimplifyContext<'_, 'tcx> {
354
348
}
355
349
356
350
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) ;
358
352
match known_is_valid {
359
353
// We don't know the layout or it's not validity assertion at all, don't touch it
360
354
None => { }
0 commit comments