@@ -81,30 +81,32 @@ impl<T: fmt::UpperHex> fmt::UpperHex for Saturating<T> {
81
81
#[ allow( unused_macros) ]
82
82
macro_rules! sh_impl_signed {
83
83
( $t: ident, $f: ident) => {
84
- #[ unstable( feature = "saturating_int_impl" , issue = "87920" ) ]
85
- impl Shl <$f> for Saturating <$t> {
86
- type Output = Saturating <$t>;
87
-
88
- #[ inline]
89
- fn shl( self , other: $f) -> Saturating <$t> {
90
- if other < 0 {
91
- Saturating ( self . 0 . shr( ( -other & self :: shift_max:: $t as $f) as u32 ) )
92
- } else {
93
- Saturating ( self . 0 . shl( ( other & self :: shift_max:: $t as $f) as u32 ) )
94
- }
95
- }
96
- }
97
- forward_ref_binop! { impl Shl , shl for Saturating <$t>, $f,
98
- #[ unstable( feature = "saturating_int_impl" , issue = "87920" ) ] }
99
-
100
- #[ unstable( feature = "saturating_int_impl" , issue = "87920" ) ]
101
- impl ShlAssign <$f> for Saturating <$t> {
102
- #[ inline]
103
- fn shl_assign( & mut self , other: $f) {
104
- * self = * self << other;
105
- }
106
- }
107
- forward_ref_op_assign! { impl ShlAssign , shl_assign for Saturating <$t>, $f }
84
+ // FIXME what is the correct implementation here? see discussion https://github.com/rust-lang/rust/pull/87921#discussion_r695870065
85
+ //
86
+ // #[unstable(feature = "saturating_int_impl", issue = "87920")]
87
+ // impl Shl<$f> for Saturating<$t> {
88
+ // type Output = Saturating<$t>;
89
+ //
90
+ // #[inline]
91
+ // fn shl(self, other: $f) -> Saturating<$t> {
92
+ // if other < 0 {
93
+ // Saturating(self.0.shr((-other & self::shift_max::$t as $f) as u32))
94
+ // } else {
95
+ // Saturating(self.0.shl((other & self::shift_max::$t as $f) as u32))
96
+ // }
97
+ // }
98
+ // }
99
+ // forward_ref_binop! { impl Shl, shl for Saturating<$t>, $f,
100
+ // #[unstable(feature = "saturating_int_impl", issue = "87920")] }
101
+ //
102
+ // #[unstable(feature = "saturating_int_impl", issue = "87920")]
103
+ // impl ShlAssign<$f> for Saturating<$t> {
104
+ // #[inline]
105
+ // fn shl_assign(&mut self, other: $f) {
106
+ // *self = *self << other;
107
+ // }
108
+ // }
109
+ // forward_ref_op_assign! { impl ShlAssign, shl_assign for Saturating<$t>, $f }
108
110
109
111
#[ unstable( feature = "saturating_int_impl" , issue = "87920" ) ]
110
112
impl Shr <$f> for Saturating <$t> {
@@ -935,38 +937,40 @@ macro_rules! saturating_int_impl_unsigned {
935
937
936
938
saturating_int_impl_unsigned ! { usize u8 u16 u32 u64 u128 }
937
939
938
- mod shift_max {
939
- #![ allow( non_upper_case_globals) ]
940
-
941
- #[ cfg( target_pointer_width = "16" ) ]
942
- mod platform {
943
- pub const usize: u32 = super :: u16;
944
- pub const isize: u32 = super :: i16;
945
- }
946
-
947
- #[ cfg( target_pointer_width = "32" ) ]
948
- mod platform {
949
- pub const usize: u32 = super :: u32;
950
- pub const isize: u32 = super :: i32;
951
- }
952
-
953
- #[ cfg( target_pointer_width = "64" ) ]
954
- mod platform {
955
- pub const usize: u32 = super :: u64;
956
- pub const isize: u32 = super :: i64;
957
- }
958
-
959
- pub const i8: u32 = ( 1 << 3 ) - 1 ;
960
- pub const i16: u32 = ( 1 << 4 ) - 1 ;
961
- pub const i32: u32 = ( 1 << 5 ) - 1 ;
962
- pub const i64: u32 = ( 1 << 6 ) - 1 ;
963
- pub const i128: u32 = ( 1 << 7 ) - 1 ;
964
- pub use self :: platform:: isize;
965
-
966
- pub const u8: u32 = i8;
967
- pub const u16: u32 = i16;
968
- pub const u32: u32 = i32;
969
- pub const u64: u32 = i64;
970
- pub const u128: u32 = i128;
971
- pub use self :: platform:: usize;
972
- }
940
+ // Related to potential Shl and ShlAssign implementation
941
+ //
942
+ // mod shift_max {
943
+ // #![allow(non_upper_case_globals)]
944
+ //
945
+ // #[cfg(target_pointer_width = "16")]
946
+ // mod platform {
947
+ // pub const usize: u32 = super::u16;
948
+ // pub const isize: u32 = super::i16;
949
+ // }
950
+ //
951
+ // #[cfg(target_pointer_width = "32")]
952
+ // mod platform {
953
+ // pub const usize: u32 = super::u32;
954
+ // pub const isize: u32 = super::i32;
955
+ // }
956
+ //
957
+ // #[cfg(target_pointer_width = "64")]
958
+ // mod platform {
959
+ // pub const usize: u32 = super::u64;
960
+ // pub const isize: u32 = super::i64;
961
+ // }
962
+ //
963
+ // pub const i8: u32 = (1 << 3) - 1;
964
+ // pub const i16: u32 = (1 << 4) - 1;
965
+ // pub const i32: u32 = (1 << 5) - 1;
966
+ // pub const i64: u32 = (1 << 6) - 1;
967
+ // pub const i128: u32 = (1 << 7) - 1;
968
+ // pub use self::platform::isize;
969
+ //
970
+ // pub const u8: u32 = i8;
971
+ // pub const u16: u32 = i16;
972
+ // pub const u32: u32 = i32;
973
+ // pub const u64: u32 = i64;
974
+ // pub const u128: u32 = i128;
975
+ // pub use self::platform::usize;
976
+ // }
0 commit comments