@@ -1519,6 +1519,10 @@ pub trait HasTyCtxt<'tcx>: HasDataLayout {
1519
1519
fn tcx < ' a > ( & ' a self ) -> TyCtxt < ' a , ' tcx , ' tcx > ;
1520
1520
}
1521
1521
1522
+ pub trait HasParamEnv < ' tcx > {
1523
+ fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > ;
1524
+ }
1525
+
1522
1526
impl < ' a , ' gcx , ' tcx > HasDataLayout for TyCtxt < ' a , ' gcx , ' tcx > {
1523
1527
fn data_layout ( & self ) -> & TargetDataLayout {
1524
1528
& self . data_layout
@@ -1531,6 +1535,12 @@ impl<'a, 'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'a, 'gcx, 'tcx> {
1531
1535
}
1532
1536
}
1533
1537
1538
+ impl < ' tcx , C > HasParamEnv < ' tcx > for LayoutCx < ' tcx , C > {
1539
+ fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > {
1540
+ self . param_env
1541
+ }
1542
+ }
1543
+
1534
1544
impl < ' tcx , T : HasDataLayout > HasDataLayout for LayoutCx < ' tcx , T > {
1535
1545
fn data_layout ( & self ) -> & TargetDataLayout {
1536
1546
self . tcx . data_layout ( )
@@ -1662,16 +1672,6 @@ impl ty::query::TyCtxtAt<'a, 'tcx, '_> {
1662
1672
}
1663
1673
}
1664
1674
1665
- pub trait HasParamEnv < ' tcx > {
1666
- fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > ;
1667
- }
1668
-
1669
- impl < ' tcx , C > HasParamEnv < ' tcx > for LayoutCx < ' tcx , C > {
1670
- fn param_env ( & self ) -> ty:: ParamEnv < ' tcx > {
1671
- self . param_env
1672
- }
1673
- }
1674
-
1675
1675
impl < ' a , ' tcx , C > TyLayoutMethods < ' tcx , C > for Ty < ' tcx >
1676
1676
where C : LayoutOf < Ty = Ty < ' tcx > > + HasTyCtxt < ' tcx > ,
1677
1677
C :: TyLayout : MaybeResult < TyLayout < ' tcx > > ,
@@ -1718,9 +1718,10 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
1718
1718
let tcx = cx. tcx ( ) ;
1719
1719
let discr_layout = |discr : & Scalar | -> C :: TyLayout {
1720
1720
let layout = LayoutDetails :: scalar ( cx, discr. clone ( ) ) ;
1721
- MaybeResult :: from ( Ok (
1722
- TyLayout { details : tcx. intern_layout ( layout) , ty : discr. value . to_ty ( tcx) }
1723
- ) )
1721
+ MaybeResult :: from ( Ok ( TyLayout {
1722
+ details : tcx. intern_layout ( layout) ,
1723
+ ty : discr. value . to_ty ( tcx) ,
1724
+ } ) )
1724
1725
} ;
1725
1726
1726
1727
cx. layout_of ( match this. ty . sty {
@@ -1754,12 +1755,10 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
1754
1755
} else {
1755
1756
tcx. mk_mut_ref ( tcx. lifetimes . re_static , nil)
1756
1757
} ;
1757
- return MaybeResult :: from (
1758
- cx. layout_of ( ptr_ty) . to_result ( ) . map ( |mut ptr_layout| {
1759
- ptr_layout. ty = this. ty ;
1760
- ptr_layout
1761
- } )
1762
- ) ;
1758
+ return MaybeResult :: from ( cx. layout_of ( ptr_ty) . to_result ( ) . map ( |mut ptr_layout| {
1759
+ ptr_layout. ty = this. ty ;
1760
+ ptr_layout
1761
+ } ) ) ;
1763
1762
}
1764
1763
1765
1764
match tcx. struct_tail ( pointee) . sty {
0 commit comments