11use rustc_middle:: bug;
2- use rustc_middle:: ty:: layout:: { LayoutCx , LayoutError , LayoutOf , TyAndLayout , ValidityRequirement } ;
2+ use rustc_middle:: ty:: layout:: {
3+ HasTyCtxt , LayoutCx , LayoutError , LayoutOf , TyAndLayout , ValidityRequirement ,
4+ } ;
35use rustc_middle:: ty:: { ParamEnvAnd , Ty , TyCtxt } ;
46use rustc_target:: abi:: { Abi , FieldsShape , Scalar , Variants } ;
57
@@ -30,7 +32,7 @@ pub fn check_validity_requirement<'tcx>(
3032 return Ok ( !layout. abi . is_uninhabited ( ) ) ;
3133 }
3234
33- let layout_cx = LayoutCx { tcx, param_env : param_env_and_ty. param_env } ;
35+ let layout_cx = LayoutCx :: new ( tcx, param_env_and_ty. param_env ) ;
3436 if kind == ValidityRequirement :: Uninit || tcx. sess . opts . unstable_opts . strict_init_checks {
3537 check_validity_requirement_strict ( layout, & layout_cx, kind)
3638 } else {
@@ -42,12 +44,12 @@ pub fn check_validity_requirement<'tcx>(
4244/// for details.
4345fn check_validity_requirement_strict < ' tcx > (
4446 ty : TyAndLayout < ' tcx > ,
45- cx : & LayoutCx < ' tcx , TyCtxt < ' tcx > > ,
47+ cx : & LayoutCx < ' tcx > ,
4648 kind : ValidityRequirement ,
4749) -> Result < bool , & ' tcx LayoutError < ' tcx > > {
4850 let machine = CompileTimeMachine :: new ( CanAccessMutGlobal :: No , CheckAlignment :: Error ) ;
4951
50- let mut cx = InterpCx :: new ( cx. tcx , rustc_span:: DUMMY_SP , cx. param_env , machine) ;
52+ let mut cx = InterpCx :: new ( cx. tcx ( ) , rustc_span:: DUMMY_SP , cx. param_env , machine) ;
5153
5254 let allocated = cx
5355 . allocate ( ty, MemoryKind :: Machine ( crate :: const_eval:: MemoryKind :: Heap ) )
@@ -80,7 +82,7 @@ fn check_validity_requirement_strict<'tcx>(
8082/// function for details.
8183fn check_validity_requirement_lax < ' tcx > (
8284 this : TyAndLayout < ' tcx > ,
83- cx : & LayoutCx < ' tcx , TyCtxt < ' tcx > > ,
85+ cx : & LayoutCx < ' tcx > ,
8486 init_kind : ValidityRequirement ,
8587) -> Result < bool , & ' tcx LayoutError < ' tcx > > {
8688 let scalar_allows_raw_init = move |s : Scalar | -> bool {
0 commit comments