@@ -181,7 +181,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
181181fn  layout_raw < ' tcx > ( 
182182    tcx :  TyCtxt < ' tcx > , 
183183    query :  ty:: ParamEnvAnd < ' tcx ,  Ty < ' tcx > > , 
184- )  -> Result < & ' tcx  LayoutDetails ,  LayoutError < ' tcx > >  { 
184+ )  -> Result < & ' tcx  Layout ,  LayoutError < ' tcx > >  { 
185185    ty:: tls:: with_related_context ( tcx,  move  |icx| { 
186186        let  rec_limit = * tcx. sess . recursion_limit . get ( ) ; 
187187        let  ( param_env,  ty)  = query. into_parts ( ) ; 
@@ -240,7 +240,7 @@ fn invert_mapping(map: &[u32]) -> Vec<u32> {
240240} 
241241
242242impl < ' tcx >  LayoutCx < ' tcx ,  TyCtxt < ' tcx > >  { 
243-     fn  scalar_pair ( & self ,  a :  Scalar ,  b :  Scalar )  -> LayoutDetails  { 
243+     fn  scalar_pair ( & self ,  a :  Scalar ,  b :  Scalar )  -> Layout  { 
244244        let  dl = self . data_layout ( ) ; 
245245        let  b_align = b. value . align ( dl) ; 
246246        let  align = a. value . align ( dl) . max ( b_align) . max ( dl. aggregate_align ) ; 
@@ -254,7 +254,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
254254            . chain ( Niche :: from_scalar ( dl,  Size :: ZERO ,  a. clone ( ) ) ) 
255255            . max_by_key ( |niche| niche. available ( dl) ) ; 
256256
257-         LayoutDetails  { 
257+         Layout  { 
258258            variants :  Variants :: Single  {  index :  VariantIdx :: new ( 0 )  } , 
259259            fields :  FieldPlacement :: Arbitrary  { 
260260                offsets :  vec ! [ Size :: ZERO ,  b_offset] , 
@@ -273,7 +273,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
273273        fields :  & [ TyLayout < ' _ > ] , 
274274        repr :  & ReprOptions , 
275275        kind :  StructKind , 
276-     )  -> Result < LayoutDetails ,  LayoutError < ' tcx > >  { 
276+     )  -> Result < Layout ,  LayoutError < ' tcx > >  { 
277277        let  dl = self . data_layout ( ) ; 
278278        let  pack = repr. pack ; 
279279        if  pack. is_some ( )  && repr. align . is_some ( )  { 
@@ -422,17 +422,11 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
422422                    ( 
423423                        Some ( ( 
424424                            i, 
425-                             & TyLayout  { 
426-                                 details :  & LayoutDetails  {  abi :  Abi :: Scalar ( ref  a) ,  .. } , 
427-                                 ..
428-                             } , 
425+                             & TyLayout  {  layout :  & Layout  {  abi :  Abi :: Scalar ( ref  a) ,  .. } ,  .. } , 
429426                        ) ) , 
430427                        Some ( ( 
431428                            j, 
432-                             & TyLayout  { 
433-                                 details :  & LayoutDetails  {  abi :  Abi :: Scalar ( ref  b) ,  .. } , 
434-                                 ..
435-                             } , 
429+                             & TyLayout  {  layout :  & Layout  {  abi :  Abi :: Scalar ( ref  b) ,  .. } ,  .. } , 
436430                        ) ) , 
437431                        None , 
438432                    )  => { 
@@ -470,7 +464,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
470464            abi = Abi :: Uninhabited ; 
471465        } 
472466
473-         Ok ( LayoutDetails  { 
467+         Ok ( Layout  { 
474468            variants :  Variants :: Single  {  index :  VariantIdx :: new ( 0 )  } , 
475469            fields :  FieldPlacement :: Arbitrary  {  offsets,  memory_index } , 
476470            abi, 
@@ -480,7 +474,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
480474        } ) 
481475    } 
482476
483-     fn  layout_raw_uncached ( & self ,  ty :  Ty < ' tcx > )  -> Result < & ' tcx  LayoutDetails ,  LayoutError < ' tcx > >  { 
477+     fn  layout_raw_uncached ( & self ,  ty :  Ty < ' tcx > )  -> Result < & ' tcx  Layout ,  LayoutError < ' tcx > >  { 
484478        let  tcx = self . tcx ; 
485479        let  param_env = self . param_env ; 
486480        let  dl = self . data_layout ( ) ; 
@@ -489,8 +483,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
489483            assert ! ( bits <= 128 ) ; 
490484            Scalar  {  value,  valid_range :  0 ..=( !0  >> ( 128  - bits) )  } 
491485        } ; 
492-         let  scalar =
493-             |value :  Primitive | tcx. intern_layout ( LayoutDetails :: scalar ( self ,  scalar_unit ( value) ) ) ; 
486+         let  scalar = |value :  Primitive | tcx. intern_layout ( Layout :: scalar ( self ,  scalar_unit ( value) ) ) ; 
494487
495488        let  univariant = |fields :  & [ TyLayout < ' _ > ] ,  repr :  & ReprOptions ,  kind| { 
496489            Ok ( tcx. intern_layout ( self . univariant_uninterned ( ty,  fields,  repr,  kind) ?) ) 
@@ -499,11 +492,11 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
499492
500493        Ok ( match  ty. kind  { 
501494            // Basic scalars. 
502-             ty:: Bool  => tcx. intern_layout ( LayoutDetails :: scalar ( 
495+             ty:: Bool  => tcx. intern_layout ( Layout :: scalar ( 
503496                self , 
504497                Scalar  {  value :  Int ( I8 ,  false ) ,  valid_range :  0 ..=1  } , 
505498            ) ) , 
506-             ty:: Char  => tcx. intern_layout ( LayoutDetails :: scalar ( 
499+             ty:: Char  => tcx. intern_layout ( Layout :: scalar ( 
507500                self , 
508501                Scalar  {  value :  Int ( I32 ,  false ) ,  valid_range :  0 ..=0x10FFFF  } , 
509502            ) ) , 
@@ -516,11 +509,11 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
516509            ty:: FnPtr ( _)  => { 
517510                let  mut  ptr = scalar_unit ( Pointer ) ; 
518511                ptr. valid_range  = 1 ..=* ptr. valid_range . end ( ) ; 
519-                 tcx. intern_layout ( LayoutDetails :: scalar ( self ,  ptr) ) 
512+                 tcx. intern_layout ( Layout :: scalar ( self ,  ptr) ) 
520513            } 
521514
522515            // The never type. 
523-             ty:: Never  => tcx. intern_layout ( LayoutDetails  { 
516+             ty:: Never  => tcx. intern_layout ( Layout  { 
524517                variants :  Variants :: Single  {  index :  VariantIdx :: new ( 0 )  } , 
525518                fields :  FieldPlacement :: Union ( 0 ) , 
526519                abi :  Abi :: Uninhabited , 
@@ -538,13 +531,13 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
538531
539532                let  pointee = tcx. normalize_erasing_regions ( param_env,  pointee) ; 
540533                if  pointee. is_sized ( tcx. at ( DUMMY_SP ) ,  param_env)  { 
541-                     return  Ok ( tcx. intern_layout ( LayoutDetails :: scalar ( self ,  data_ptr) ) ) ; 
534+                     return  Ok ( tcx. intern_layout ( Layout :: scalar ( self ,  data_ptr) ) ) ; 
542535                } 
543536
544537                let  unsized_part = tcx. struct_tail_erasing_lifetimes ( pointee,  param_env) ; 
545538                let  metadata = match  unsized_part. kind  { 
546539                    ty:: Foreign ( ..)  => { 
547-                         return  Ok ( tcx. intern_layout ( LayoutDetails :: scalar ( self ,  data_ptr) ) ) ; 
540+                         return  Ok ( tcx. intern_layout ( Layout :: scalar ( self ,  data_ptr) ) ) ; 
548541                    } 
549542                    ty:: Slice ( _)  | ty:: Str  => scalar_unit ( Int ( dl. ptr_sized_integer ( ) ,  false ) ) , 
550543                    ty:: Dynamic ( ..)  => { 
@@ -581,7 +574,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
581574
582575                let  largest_niche = if  count != 0  {  element. largest_niche . clone ( )  }  else  {  None  } ; 
583576
584-                 tcx. intern_layout ( LayoutDetails  { 
577+                 tcx. intern_layout ( Layout  { 
585578                    variants :  Variants :: Single  {  index :  VariantIdx :: new ( 0 )  } , 
586579                    fields :  FieldPlacement :: Array  {  stride :  element. size ,  count } , 
587580                    abi, 
@@ -592,7 +585,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
592585            } 
593586            ty:: Slice ( element)  => { 
594587                let  element = self . layout_of ( element) ?; 
595-                 tcx. intern_layout ( LayoutDetails  { 
588+                 tcx. intern_layout ( Layout  { 
596589                    variants :  Variants :: Single  {  index :  VariantIdx :: new ( 0 )  } , 
597590                    fields :  FieldPlacement :: Array  {  stride :  element. size ,  count :  0  } , 
598591                    abi :  Abi :: Aggregate  {  sized :  false  } , 
@@ -601,7 +594,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
601594                    size :  Size :: ZERO , 
602595                } ) 
603596            } 
604-             ty:: Str  => tcx. intern_layout ( LayoutDetails  { 
597+             ty:: Str  => tcx. intern_layout ( Layout  { 
605598                variants :  Variants :: Single  {  index :  VariantIdx :: new ( 0 )  } , 
606599                fields :  FieldPlacement :: Array  {  stride :  Size :: from_bytes ( 1 ) ,  count :  0  } , 
607600                abi :  Abi :: Aggregate  {  sized :  false  } , 
@@ -670,7 +663,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
670663                let  align = dl. vector_align ( size) ; 
671664                let  size = size. align_to ( align. abi ) ; 
672665
673-                 tcx. intern_layout ( LayoutDetails  { 
666+                 tcx. intern_layout ( Layout  { 
674667                    variants :  Variants :: Single  {  index :  VariantIdx :: new ( 0 )  } , 
675668                    fields :  FieldPlacement :: Array  {  stride :  element. size ,  count } , 
676669                    abi :  Abi :: Vector  {  element :  scalar,  count } , 
@@ -746,7 +739,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
746739                        align = align. min ( AbiAndPrefAlign :: new ( pack) ) ; 
747740                    } 
748741
749-                     return  Ok ( tcx. intern_layout ( LayoutDetails  { 
742+                     return  Ok ( tcx. intern_layout ( Layout  { 
750743                        variants :  Variants :: Single  {  index } , 
751744                        fields :  FieldPlacement :: Union ( variants[ index] . len ( ) ) , 
752745                        abi, 
@@ -970,7 +963,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
970963                            let  largest_niche =
971964                                Niche :: from_scalar ( dl,  offset,  niche_scalar. clone ( ) ) ; 
972965
973-                             return  Ok ( tcx. intern_layout ( LayoutDetails  { 
966+                             return  Ok ( tcx. intern_layout ( Layout  { 
974967                                variants :  Variants :: Multiple  { 
975968                                    discr :  niche_scalar, 
976969                                    discr_kind :  DiscriminantKind :: Niche  { 
@@ -1165,7 +1158,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
11651158                                break ; 
11661159                            } 
11671160                        } ; 
1168-                         let  prim = match  field. details . abi  { 
1161+                         let  prim = match  field. abi  { 
11691162                            Abi :: Scalar ( ref  scalar)  => scalar. value , 
11701163                            _ => { 
11711164                                common_prim = None ; 
@@ -1212,7 +1205,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
12121205
12131206                let  largest_niche = Niche :: from_scalar ( dl,  Size :: ZERO ,  tag. clone ( ) ) ; 
12141207
1215-                 tcx. intern_layout ( LayoutDetails  { 
1208+                 tcx. intern_layout ( Layout  { 
12161209                    variants :  Variants :: Multiple  { 
12171210                        discr :  tag, 
12181211                        discr_kind :  DiscriminantKind :: Tag , 
@@ -1243,7 +1236,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
12431236            | ty:: Placeholder ( ..) 
12441237            | ty:: UnnormalizedProjection ( ..) 
12451238            | ty:: GeneratorWitness ( ..) 
1246-             | ty:: Infer ( _)  => bug ! ( "LayoutDetails ::compute: unexpected type `{}`" ,  ty) , 
1239+             | ty:: Infer ( _)  => bug ! ( "Layout ::compute: unexpected type `{}`" ,  ty) , 
12471240
12481241            ty:: Param ( _)  | ty:: Error  => { 
12491242                return  Err ( LayoutError :: Unknown ( ty) ) ; 
@@ -1390,7 +1383,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
13901383        ty :  Ty < ' tcx > , 
13911384        def_id :  hir:: def_id:: DefId , 
13921385        substs :  SubstsRef < ' tcx > , 
1393-     )  -> Result < & ' tcx  LayoutDetails ,  LayoutError < ' tcx > >  { 
1386+     )  -> Result < & ' tcx  Layout ,  LayoutError < ' tcx > >  { 
13941387        use  SavedLocalEligibility :: * ; 
13951388        let  tcx = self . tcx ; 
13961389
@@ -1409,8 +1402,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
14091402        let  discr_int = Integer :: fit_unsigned ( max_discr) ; 
14101403        let  discr_int_ty = discr_int. to_ty ( tcx,  false ) ; 
14111404        let  discr = Scalar  {  value :  Primitive :: Int ( discr_int,  false ) ,  valid_range :  0 ..=max_discr } ; 
1412-         let  discr_layout = self . tcx . intern_layout ( LayoutDetails :: scalar ( self ,  discr. clone ( ) ) ) ; 
1413-         let  discr_layout = TyLayout  {  ty :  discr_int_ty,  details :  discr_layout } ; 
1405+         let  discr_layout = self . tcx . intern_layout ( Layout :: scalar ( self ,  discr. clone ( ) ) ) ; 
1406+         let  discr_layout = TyLayout  {  ty :  discr_int_ty,  layout :  discr_layout } ; 
14141407
14151408        let  promoted_layouts = ineligible_locals
14161409            . iter ( ) 
@@ -1559,7 +1552,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
15591552            Abi :: Aggregate  {  sized :  true  } 
15601553        } ; 
15611554
1562-         let  layout = tcx. intern_layout ( LayoutDetails  { 
1555+         let  layout = tcx. intern_layout ( Layout  { 
15631556            variants :  Variants :: Multiple  { 
15641557                discr, 
15651558                discr_kind :  DiscriminantKind :: Tag , 
@@ -1908,8 +1901,8 @@ impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx>> {
19081901     fn  layout_of ( & self ,  ty :  Ty < ' tcx > )  -> Self :: TyLayout  { 
19091902        let  param_env = self . param_env . with_reveal_all ( ) ; 
19101903        let  ty = self . tcx . normalize_erasing_regions ( param_env,  ty) ; 
1911-         let  details  = self . tcx . layout_raw ( param_env. and ( ty) ) ?; 
1912-         let  layout = TyLayout  {  ty,  details  } ; 
1904+         let  layout  = self . tcx . layout_raw ( param_env. and ( ty) ) ?; 
1905+         let  layout = TyLayout  {  ty,  layout  } ; 
19131906
19141907        // N.B., this recording is normally disabled; when enabled, it 
19151908        // can however trigger recursive invocations of `layout_of`. 
@@ -1932,8 +1925,8 @@ impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
19321925     fn  layout_of ( & self ,  ty :  Ty < ' tcx > )  -> Self :: TyLayout  { 
19331926        let  param_env = self . param_env . with_reveal_all ( ) ; 
19341927        let  ty = self . tcx . normalize_erasing_regions ( param_env,  ty) ; 
1935-         let  details  = self . tcx . layout_raw ( param_env. and ( ty) ) ?; 
1936-         let  layout = TyLayout  {  ty,  details  } ; 
1928+         let  layout  = self . tcx . layout_raw ( param_env. and ( ty) ) ?; 
1929+         let  layout = TyLayout  {  ty,  layout  } ; 
19371930
19381931        // N.B., this recording is normally disabled; when enabled, it 
19391932        // can however trigger recursive invocations of `layout_of`. 
@@ -1982,29 +1975,29 @@ where
19821975        + HasParamEnv < ' tcx > , 
19831976{ 
19841977    fn  for_variant ( this :  TyLayout < ' tcx > ,  cx :  & C ,  variant_index :  VariantIdx )  -> TyLayout < ' tcx >  { 
1985-         let  details  = match  this. variants  { 
1978+         let  layout  = match  this. variants  { 
19861979            Variants :: Single  {  index } 
19871980                // If all variants but one are uninhabited, the variant layout is the enum layout. 
19881981                if  index == variant_index &&
19891982                // Don't confuse variants of uninhabited enums with the enum itself. 
19901983                // For more details see https://github.com/rust-lang/rust/issues/69763. 
19911984                this. fields  != FieldPlacement :: Union ( 0 )  =>
19921985            { 
1993-                 this. details 
1986+                 this. layout 
19941987            } 
19951988
19961989            Variants :: Single  {  index }  => { 
19971990                // Deny calling for_variant more than once for non-Single enums. 
1998-                 if  let  Ok ( layout )  = cx. layout_of ( this. ty ) . to_result ( )  { 
1999-                     assert_eq ! ( layout . variants,  Variants :: Single  {  index } ) ; 
1991+                 if  let  Ok ( original_layout )  = cx. layout_of ( this. ty ) . to_result ( )  { 
1992+                     assert_eq ! ( original_layout . variants,  Variants :: Single  {  index } ) ; 
20001993                } 
20011994
20021995                let  fields = match  this. ty . kind  { 
20031996                    ty:: Adt ( def,  _)  => def. variants [ variant_index] . fields . len ( ) , 
20041997                    _ => bug ! ( ) , 
20051998                } ; 
20061999                let  tcx = cx. tcx ( ) ; 
2007-                 tcx. intern_layout ( LayoutDetails  { 
2000+                 tcx. intern_layout ( Layout  { 
20082001                    variants :  Variants :: Single  {  index :  variant_index } , 
20092002                    fields :  FieldPlacement :: Union ( fields) , 
20102003                    abi :  Abi :: Uninhabited , 
@@ -2017,17 +2010,17 @@ where
20172010            Variants :: Multiple  {  ref  variants,  .. }  => & variants[ variant_index] , 
20182011        } ; 
20192012
2020-         assert_eq ! ( details . variants,  Variants :: Single  {  index:  variant_index } ) ; 
2013+         assert_eq ! ( layout . variants,  Variants :: Single  {  index:  variant_index } ) ; 
20212014
2022-         TyLayout  {  ty :  this. ty ,  details  } 
2015+         TyLayout  {  ty :  this. ty ,  layout  } 
20232016    } 
20242017
20252018    fn  field ( this :  TyLayout < ' tcx > ,  cx :  & C ,  i :  usize )  -> C :: TyLayout  { 
20262019        let  tcx = cx. tcx ( ) ; 
20272020        let  discr_layout = |discr :  & Scalar | -> C :: TyLayout  { 
2028-             let  layout = LayoutDetails :: scalar ( cx,  discr. clone ( ) ) ; 
2021+             let  layout = Layout :: scalar ( cx,  discr. clone ( ) ) ; 
20292022            MaybeResult :: from ( Ok ( TyLayout  { 
2030-                 details :  tcx. intern_layout ( layout) , 
2023+                 layout :  tcx. intern_layout ( layout) , 
20312024                ty :  discr. value . to_ty ( tcx) , 
20322025            } ) ) 
20332026        } ; 
0 commit comments