@@ -115,7 +115,7 @@ unsafe fn bswap8(x: u8) -> u8 { x }
115115
116116// `Int` + `SignedInt` implemented for signed integers
117117macro_rules! int_impl {
118- ( $ActualT: ty, $UnsignedT: ty, $BITS: expr,
118+ ( $SelfT : ty , $ ActualT: ty, $UnsignedT: ty, $BITS: expr,
119119 $add_with_overflow: path,
120120 $sub_with_overflow: path,
121121 $mul_with_overflow: path) => {
@@ -139,13 +139,13 @@ macro_rules! int_impl {
139139 // calling the `Bounded::min_value` function.
140140 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
141141 #[ allow( missing_docs) ]
142- pub const MIN : $ActualT = ( -1 as $ActualT ) << ( $BITS - 1 ) ;
142+ pub const MIN : $SelfT = ( -1 as $SelfT ) << ( $BITS - 1 ) ;
143143 // FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
144144 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
145145 // calling the `Bounded::max_value` function.
146146 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
147147 #[ allow( missing_docs) ]
148- pub const MAX : $ActualT = !<$ActualT >:: MIN ;
148+ pub const MAX : $SelfT = !<$SelfT >:: MIN ;
149149
150150 /// Returns the smallest value that can be represented by this integer type.
151151 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -639,31 +639,31 @@ macro_rules! int_impl {
639639
640640#[ lang = "i8" ]
641641impl i8 {
642- int_impl ! { i8 , u8 , 8 ,
642+ int_impl ! { i8 , i8 , u8 , 8 ,
643643 intrinsics:: i8_add_with_overflow,
644644 intrinsics:: i8_sub_with_overflow,
645645 intrinsics:: i8_mul_with_overflow }
646646}
647647
648648#[ lang = "i16" ]
649649impl i16 {
650- int_impl ! { i16 , u16 , 16 ,
650+ int_impl ! { i16 , i16 , u16 , 16 ,
651651 intrinsics:: i16_add_with_overflow,
652652 intrinsics:: i16_sub_with_overflow,
653653 intrinsics:: i16_mul_with_overflow }
654654}
655655
656656#[ lang = "i32" ]
657657impl i32 {
658- int_impl ! { i32 , u32 , 32 ,
658+ int_impl ! { i32 , i32 , u32 , 32 ,
659659 intrinsics:: i32_add_with_overflow,
660660 intrinsics:: i32_sub_with_overflow,
661661 intrinsics:: i32_mul_with_overflow }
662662}
663663
664664#[ lang = "i64" ]
665665impl i64 {
666- int_impl ! { i64 , u64 , 64 ,
666+ int_impl ! { i64 , i64 , u64 , 64 ,
667667 intrinsics:: i64_add_with_overflow,
668668 intrinsics:: i64_sub_with_overflow,
669669 intrinsics:: i64_mul_with_overflow }
@@ -672,7 +672,7 @@ impl i64 {
672672#[ cfg( target_pointer_width = "32" ) ]
673673#[ lang = "isize" ]
674674impl isize {
675- int_impl ! { i32 , u32 , 32 ,
675+ int_impl ! { isize , i32 , u32 , 32 ,
676676 intrinsics:: i32_add_with_overflow,
677677 intrinsics:: i32_sub_with_overflow,
678678 intrinsics:: i32_mul_with_overflow }
@@ -681,15 +681,15 @@ impl isize {
681681#[ cfg( target_pointer_width = "64" ) ]
682682#[ lang = "isize" ]
683683impl isize {
684- int_impl ! { i64 , u64 , 64 ,
684+ int_impl ! { isize , i64 , u64 , 64 ,
685685 intrinsics:: i64_add_with_overflow,
686686 intrinsics:: i64_sub_with_overflow,
687687 intrinsics:: i64_mul_with_overflow }
688688}
689689
690690// `Int` + `UnsignedInt` implemented for signed integers
691691macro_rules! uint_impl {
692- ( $ActualT: ty, $BITS: expr,
692+ ( $SelfT : ty , $ ActualT: ty, $BITS: expr,
693693 $ctpop: path,
694694 $ctlz: path,
695695 $cttz: path,
@@ -711,10 +711,10 @@ macro_rules! uint_impl {
711711
712712 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
713713 #[ allow( missing_docs) ]
714- pub const MIN : $ActualT = 0 as $ActualT ;
714+ pub const MIN : $SelfT = 0 as $SelfT ;
715715 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
716716 #[ allow( missing_docs) ]
717- pub const MAX : $ActualT = !0 as $ActualT ;
717+ pub const MAX : $SelfT = !0 as $SelfT ;
718718
719719 /// Returns the smallest value that can be represented by this integer type.
720720 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1210,7 +1210,7 @@ macro_rules! uint_impl {
12101210
12111211#[ lang = "u8" ]
12121212impl u8 {
1213- uint_impl ! { u8 , 8 ,
1213+ uint_impl ! { u8 , u8 , 8 ,
12141214 intrinsics:: ctpop8,
12151215 intrinsics:: ctlz8,
12161216 intrinsics:: cttz8,
@@ -1222,7 +1222,7 @@ impl u8 {
12221222
12231223#[ lang = "u16" ]
12241224impl u16 {
1225- uint_impl ! { u16 , 16 ,
1225+ uint_impl ! { u16 , u16 , 16 ,
12261226 intrinsics:: ctpop16,
12271227 intrinsics:: ctlz16,
12281228 intrinsics:: cttz16,
@@ -1234,7 +1234,7 @@ impl u16 {
12341234
12351235#[ lang = "u32" ]
12361236impl u32 {
1237- uint_impl ! { u32 , 32 ,
1237+ uint_impl ! { u32 , u32 , 32 ,
12381238 intrinsics:: ctpop32,
12391239 intrinsics:: ctlz32,
12401240 intrinsics:: cttz32,
@@ -1247,7 +1247,7 @@ impl u32 {
12471247
12481248#[ lang = "u64" ]
12491249impl u64 {
1250- uint_impl ! { u64 , 64 ,
1250+ uint_impl ! { u64 , u64 , 64 ,
12511251 intrinsics:: ctpop64,
12521252 intrinsics:: ctlz64,
12531253 intrinsics:: cttz64,
@@ -1260,7 +1260,7 @@ impl u64 {
12601260#[ cfg( target_pointer_width = "32" ) ]
12611261#[ lang = "usize" ]
12621262impl usize {
1263- uint_impl ! { u32 , 32 ,
1263+ uint_impl ! { usize , u32 , 32 ,
12641264 intrinsics:: ctpop32,
12651265 intrinsics:: ctlz32,
12661266 intrinsics:: cttz32,
@@ -1273,7 +1273,7 @@ impl usize {
12731273#[ cfg( target_pointer_width = "64" ) ]
12741274#[ lang = "usize" ]
12751275impl usize {
1276- uint_impl ! { u64 , 64 ,
1276+ uint_impl ! { usize , u64 , 64 ,
12771277 intrinsics:: ctpop64,
12781278 intrinsics:: ctlz64,
12791279 intrinsics:: cttz64,
0 commit comments