1+ // We want to be able to build this crate with a stable compiler, so no
2+ // `#![feature]` attributes should be added.
13#![ cfg_attr( feature = "nightly" , feature( step_trait, rustc_attrs, min_specialization) ) ]
24#![ cfg_attr( feature = "nightly" , allow( internal_features) ) ]
35
@@ -28,9 +30,6 @@ pub use layout::LayoutCalculator;
2830/// instead of implementing everything in `rustc_middle`.
2931pub trait HashStableContext { }
3032
31- use Integer :: * ;
32- use Primitive :: * ;
33-
3433bitflags ! {
3534 #[ derive( Default ) ]
3635 #[ cfg_attr( feature = "nightly" , derive( Encodable , Decodable , HashStable_Generic ) ) ]
@@ -342,6 +341,7 @@ impl TargetDataLayout {
342341
343342 #[ inline]
344343 pub fn ptr_sized_integer ( & self ) -> Integer {
344+ use Integer :: * ;
345345 match self . pointer_size . bits ( ) {
346346 16 => I16 ,
347347 32 => I32 ,
@@ -786,6 +786,7 @@ pub enum Integer {
786786impl Integer {
787787 #[ inline]
788788 pub fn size ( self ) -> Size {
789+ use Integer :: * ;
789790 match self {
790791 I8 => Size :: from_bytes ( 1 ) ,
791792 I16 => Size :: from_bytes ( 2 ) ,
@@ -806,6 +807,7 @@ impl Integer {
806807 }
807808
808809 pub fn align < C : HasDataLayout > ( self , cx : & C ) -> AbiAndPrefAlign {
810+ use Integer :: * ;
809811 let dl = cx. data_layout ( ) ;
810812
811813 match self {
@@ -820,6 +822,7 @@ impl Integer {
820822 /// Returns the largest signed value that can be represented by this Integer.
821823 #[ inline]
822824 pub fn signed_max ( self ) -> i128 {
825+ use Integer :: * ;
823826 match self {
824827 I8 => i8:: MAX as i128 ,
825828 I16 => i16:: MAX as i128 ,
@@ -832,6 +835,7 @@ impl Integer {
832835 /// Finds the smallest Integer type which can represent the signed value.
833836 #[ inline]
834837 pub fn fit_signed ( x : i128 ) -> Integer {
838+ use Integer :: * ;
835839 match x {
836840 -0x0000_0000_0000_0080 ..=0x0000_0000_0000_007f => I8 ,
837841 -0x0000_0000_0000_8000 ..=0x0000_0000_0000_7fff => I16 ,
@@ -844,6 +848,7 @@ impl Integer {
844848 /// Finds the smallest Integer type which can represent the unsigned value.
845849 #[ inline]
846850 pub fn fit_unsigned ( x : u128 ) -> Integer {
851+ use Integer :: * ;
847852 match x {
848853 0 ..=0x0000_0000_0000_00ff => I8 ,
849854 0 ..=0x0000_0000_0000_ffff => I16 ,
@@ -855,6 +860,7 @@ impl Integer {
855860
856861 /// Finds the smallest integer with the given alignment.
857862 pub fn for_align < C : HasDataLayout > ( cx : & C , wanted : Align ) -> Option < Integer > {
863+ use Integer :: * ;
858864 let dl = cx. data_layout ( ) ;
859865
860866 [ I8 , I16 , I32 , I64 , I128 ] . into_iter ( ) . find ( |& candidate| {
@@ -864,6 +870,7 @@ impl Integer {
864870
865871 /// Find the largest integer with the given alignment or less.
866872 pub fn approximate_align < C : HasDataLayout > ( cx : & C , wanted : Align ) -> Integer {
873+ use Integer :: * ;
867874 let dl = cx. data_layout ( ) ;
868875
869876 // FIXME(eddyb) maybe include I128 in the future, when it works everywhere.
@@ -909,6 +916,7 @@ pub enum Primitive {
909916
910917impl Primitive {
911918 pub fn size < C : HasDataLayout > ( self , cx : & C ) -> Size {
919+ use Primitive :: * ;
912920 let dl = cx. data_layout ( ) ;
913921
914922 match self {
@@ -923,6 +931,7 @@ impl Primitive {
923931 }
924932
925933 pub fn align < C : HasDataLayout > ( self , cx : & C ) -> AbiAndPrefAlign {
934+ use Primitive :: * ;
926935 let dl = cx. data_layout ( ) ;
927936
928937 match self {
@@ -1027,10 +1036,11 @@ pub enum Scalar {
10271036impl Scalar {
10281037 #[ inline]
10291038 pub fn is_bool ( & self ) -> bool {
1039+ use Integer :: * ;
10301040 matches ! (
10311041 self ,
10321042 Scalar :: Initialized {
1033- value: Int ( I8 , false ) ,
1043+ value: Primitive :: Int ( I8 , false ) ,
10341044 valid_range: WrappingRange { start: 0 , end: 1 }
10351045 }
10361046 )
0 commit comments