@@ -5,8 +5,9 @@ use hir::def_id::DefId;
55use rustc_abi:: Integer :: { I8 , I32 } ;
66use rustc_abi:: Primitive :: { self , Float , Int , Pointer } ;
77use rustc_abi:: {
8- Abi , AbiAndPrefAlign , AddressSpace , Align , FieldsShape , HasDataLayout , LayoutCalculatorError ,
9- LayoutS , Niche , ReprOptions , Scalar , Size , StructKind , TagEncoding , Variants , WrappingRange ,
8+ AbiAndPrefAlign , AddressSpace , Align , FieldsShape , HasDataLayout , IrForm ,
9+ LayoutCalculatorError , LayoutS , Niche , ReprOptions , Scalar , Size , StructKind , TagEncoding ,
10+ Variants , WrappingRange ,
1011} ;
1112use rustc_index:: bit_set:: BitSet ;
1213use rustc_index:: { IndexSlice , IndexVec } ;
@@ -173,7 +174,9 @@ fn layout_of_uncached<'tcx>(
173174 let mut layout = LayoutS :: clone ( & layout. 0 ) ;
174175 match * pat {
175176 ty:: PatternKind :: Range { start, end, include_end } => {
176- if let Abi :: Scalar ( scalar) | Abi :: ScalarPair ( scalar, _) = & mut layout. abi {
177+ if let IrForm :: Scalar ( scalar) | IrForm :: ScalarPair ( scalar, _) =
178+ & mut layout. ir_form
179+ {
177180 if let Some ( start) = start {
178181 scalar. valid_range_mut ( ) . start = start
179182 . try_to_bits ( tcx, param_env)
@@ -275,7 +278,7 @@ fn layout_of_uncached<'tcx>(
275278 return Ok ( tcx. mk_layout ( LayoutS :: scalar ( cx, data_ptr) ) ) ;
276279 }
277280
278- let Abi :: Scalar ( metadata) = metadata_layout. abi else {
281+ let IrForm :: Scalar ( metadata) = metadata_layout. ir_form else {
279282 return Err ( error ( cx, LayoutError :: Unknown ( pointee) ) ) ;
280283 } ;
281284
@@ -330,17 +333,17 @@ fn layout_of_uncached<'tcx>(
330333 . ok_or_else ( || error ( cx, LayoutError :: SizeOverflow ( ty) ) ) ?;
331334
332335 let abi = if count != 0 && ty. is_privately_uninhabited ( tcx, param_env) {
333- Abi :: Uninhabited
336+ IrForm :: Uninhabited
334337 } else {
335- Abi :: Aggregate { sized : true }
338+ IrForm :: Memory { sized : true }
336339 } ;
337340
338341 let largest_niche = if count != 0 { element. largest_niche } else { None } ;
339342
340343 tcx. mk_layout ( LayoutS {
341344 variants : Variants :: Single { index : FIRST_VARIANT } ,
342345 fields : FieldsShape :: Array { stride : element. size , count } ,
343- abi,
346+ ir_form : abi,
344347 largest_niche,
345348 align : element. align ,
346349 size,
@@ -353,7 +356,7 @@ fn layout_of_uncached<'tcx>(
353356 tcx. mk_layout ( LayoutS {
354357 variants : Variants :: Single { index : FIRST_VARIANT } ,
355358 fields : FieldsShape :: Array { stride : element. size , count : 0 } ,
356- abi : Abi :: Aggregate { sized : false } ,
359+ ir_form : IrForm :: Memory { sized : false } ,
357360 largest_niche : None ,
358361 align : element. align ,
359362 size : Size :: ZERO ,
@@ -364,7 +367,7 @@ fn layout_of_uncached<'tcx>(
364367 ty:: Str => tcx. mk_layout ( LayoutS {
365368 variants : Variants :: Single { index : FIRST_VARIANT } ,
366369 fields : FieldsShape :: Array { stride : Size :: from_bytes ( 1 ) , count : 0 } ,
367- abi : Abi :: Aggregate { sized : false } ,
370+ ir_form : IrForm :: Memory { sized : false } ,
368371 largest_niche : None ,
369372 align : dl. i8_align ,
370373 size : Size :: ZERO ,
@@ -384,8 +387,8 @@ fn layout_of_uncached<'tcx>(
384387 & ReprOptions :: default ( ) ,
385388 StructKind :: AlwaysSized ,
386389 ) ?;
387- match unit. abi {
388- Abi :: Aggregate { ref mut sized } => * sized = false ,
390+ match unit. ir_form {
391+ IrForm :: Memory { ref mut sized } => * sized = false ,
389392 _ => bug ! ( ) ,
390393 }
391394 tcx. mk_layout ( unit)
@@ -500,7 +503,7 @@ fn layout_of_uncached<'tcx>(
500503
501504 // Compute the ABI of the element type:
502505 let e_ly = cx. layout_of ( e_ty) ?;
503- let Abi :: Scalar ( e_abi) = e_ly. abi else {
506+ let IrForm :: Scalar ( e_abi) = e_ly. ir_form else {
504507 // This error isn't caught in typeck, e.g., if
505508 // the element type of the vector is generic.
506509 tcx. dcx ( ) . emit_fatal ( NonPrimitiveSimdType { ty, e_ty } ) ;
@@ -516,12 +519,12 @@ fn layout_of_uncached<'tcx>(
516519 // Non-power-of-two vectors have padding up to the next power-of-two.
517520 // If we're a packed repr, remove the padding while keeping the alignment as close
518521 // to a vector as possible.
519- ( Abi :: Aggregate { sized : true } , AbiAndPrefAlign {
522+ ( IrForm :: Memory { sized : true } , AbiAndPrefAlign {
520523 abi : Align :: max_for_offset ( size) ,
521524 pref : dl. vector_align ( size) . pref ,
522525 } )
523526 } else {
524- ( Abi :: Vector { element : e_abi, count : e_len } , dl. vector_align ( size) )
527+ ( IrForm :: Vector { element : e_abi, count : e_len } , dl. vector_align ( size) )
525528 } ;
526529 let size = size. align_to ( align. abi ) ;
527530
@@ -535,7 +538,7 @@ fn layout_of_uncached<'tcx>(
535538 tcx. mk_layout ( LayoutS {
536539 variants : Variants :: Single { index : FIRST_VARIANT } ,
537540 fields,
538- abi,
541+ ir_form : abi,
539542 largest_niche : e_ly. largest_niche ,
540543 size,
541544 align,
@@ -985,11 +988,12 @@ fn coroutine_layout<'tcx>(
985988
986989 size = size. align_to ( align. abi ) ;
987990
988- let abi = if prefix. abi . is_uninhabited ( ) || variants. iter ( ) . all ( |v| v. abi . is_uninhabited ( ) ) {
989- Abi :: Uninhabited
990- } else {
991- Abi :: Aggregate { sized : true }
992- } ;
991+ let abi =
992+ if prefix. ir_form . is_uninhabited ( ) || variants. iter ( ) . all ( |v| v. ir_form . is_uninhabited ( ) ) {
993+ IrForm :: Uninhabited
994+ } else {
995+ IrForm :: Memory { sized : true }
996+ } ;
993997
994998 let layout = tcx. mk_layout ( LayoutS {
995999 variants : Variants :: Multiple {
@@ -999,7 +1003,7 @@ fn coroutine_layout<'tcx>(
9991003 variants,
10001004 } ,
10011005 fields : outer_fields,
1002- abi,
1006+ ir_form : abi,
10031007 // Suppress niches inside coroutines. If the niche is inside a field that is aliased (due to
10041008 // self-referentiality), getting the discriminant can cause aliasing violations.
10051009 // `UnsafeCell` blocks niches for the same reason, but we don't yet have `UnsafePinned` that
0 commit comments