@@ -2,7 +2,12 @@ use std::fmt::Debug;
2
2
use std:: iter;
3
3
4
4
use hir:: def_id:: DefId ;
5
- use rustc_hir as hir;
5
+ use rustc_abi:: Integer :: { I8 , I32 } ;
6
+ use rustc_abi:: Primitive :: { self , Float , Int , Pointer } ;
7
+ use rustc_abi:: {
8
+ Abi , AbiAndPrefAlign , AddressSpace , Align , FieldsShape , HasDataLayout , LayoutCalculatorError ,
9
+ LayoutS , Niche , ReprOptions , Scalar , Size , StructKind , TagEncoding , Variants , WrappingRange ,
10
+ } ;
6
11
use rustc_index:: bit_set:: BitSet ;
7
12
use rustc_index:: { IndexSlice , IndexVec } ;
8
13
use rustc_middle:: bug;
@@ -18,8 +23,9 @@ use rustc_middle::ty::{
18
23
use rustc_session:: { DataTypeKind , FieldInfo , FieldKind , SizeKind , VariantInfo } ;
19
24
use rustc_span:: sym;
20
25
use rustc_span:: symbol:: Symbol ;
21
- use rustc_target:: abi:: * ;
26
+ use rustc_target:: abi:: { FIRST_VARIANT , FieldIdx , Layout , VariantIdx } ;
22
27
use tracing:: { debug, instrument, trace} ;
28
+ use { rustc_abi as abi, rustc_hir as hir} ;
23
29
24
30
use crate :: errors:: {
25
31
MultipleArrayFieldsSimdType , NonPrimitiveSimdType , OversizedSimdType , ZeroLengthSimdType ,
@@ -202,9 +208,9 @@ fn layout_of_uncached<'tcx>(
202
208
value : Int ( I32 , false ) ,
203
209
valid_range : WrappingRange { start : 0 , end : 0x10FFFF } ,
204
210
} ) ) ,
205
- ty:: Int ( ity) => scalar ( Int ( Integer :: from_int_ty ( dl, ity) , true ) ) ,
206
- ty:: Uint ( ity) => scalar ( Int ( Integer :: from_uint_ty ( dl, ity) , false ) ) ,
207
- ty:: Float ( fty) => scalar ( Float ( Float :: from_float_ty ( fty) ) ) ,
211
+ ty:: Int ( ity) => scalar ( Int ( abi :: Integer :: from_int_ty ( dl, ity) , true ) ) ,
212
+ ty:: Uint ( ity) => scalar ( Int ( abi :: Integer :: from_uint_ty ( dl, ity) , false ) ) ,
213
+ ty:: Float ( fty) => scalar ( Float ( abi :: Float :: from_float_ty ( fty) ) ) ,
208
214
ty:: FnPtr ( ..) => {
209
215
let mut ptr = scalar_unit ( Pointer ( dl. instruction_address_space ) ) ;
210
216
ptr. valid_range_mut ( ) . start = 1 ;
@@ -563,7 +569,7 @@ fn layout_of_uncached<'tcx>(
563
569
}
564
570
565
571
let get_discriminant_type =
566
- |min, max| Integer :: repr_discr ( tcx, ty, & def. repr ( ) , min, max) ;
572
+ |min, max| abi :: Integer :: repr_discr ( tcx, ty, & def. repr ( ) , min, max) ;
567
573
568
574
let discriminants_iter = || {
569
575
def. is_enum ( )
@@ -816,7 +822,7 @@ fn coroutine_layout<'tcx>(
816
822
817
823
// `info.variant_fields` already accounts for the reserved variants, so no need to add them.
818
824
let max_discr = ( info. variant_fields . len ( ) - 1 ) as u128 ;
819
- let discr_int = Integer :: fit_unsigned ( max_discr) ;
825
+ let discr_int = abi :: Integer :: fit_unsigned ( max_discr) ;
820
826
let tag = Scalar :: Initialized {
821
827
value : Primitive :: Int ( discr_int, /* signed = */ false ) ,
822
828
valid_range : WrappingRange { start : 0 , end : max_discr } ,
0 commit comments