@@ -96,78 +96,6 @@ pub mod dec2flt;
9696pub mod bignum;
9797pub mod diy_float;
9898
99- /// Types that have a "zero" value.
100- ///
101- /// This trait is intended for use in conjunction with `Add`, as an identity:
102- /// `x + T::zero() == x`.
103- #[ unstable( feature = "zero_one" ,
104- reason = "unsure of placement, wants to use associated constants" ,
105- issue = "27739" ) ]
106- #[ rustc_deprecated( since = "1.11.0" , reason = "no longer used for \
107- Iterator::sum") ]
108- pub trait Zero : Sized {
109- /// The "zero" (usually, additive identity) for this type.
110- fn zero ( ) -> Self ;
111- }
112-
113- /// Types that have a "one" value.
114- ///
115- /// This trait is intended for use in conjunction with `Mul`, as an identity:
116- /// `x * T::one() == x`.
117- #[ unstable( feature = "zero_one" ,
118- reason = "unsure of placement, wants to use associated constants" ,
119- issue = "27739" ) ]
120- #[ rustc_deprecated( since = "1.11.0" , reason = "no longer used for \
121- Iterator::product") ]
122- pub trait One : Sized {
123- /// The "one" (usually, multiplicative identity) for this type.
124- fn one ( ) -> Self ;
125- }
126-
127- macro_rules! zero_one_impl {
128- ( $( $t: ty) * ) => ( $(
129- #[ unstable( feature = "zero_one" ,
130- reason = "unsure of placement, wants to use associated constants" ,
131- issue = "27739" ) ]
132- #[ allow( deprecated) ]
133- impl Zero for $t {
134- #[ inline]
135- fn zero( ) -> Self { 0 }
136- }
137- #[ unstable( feature = "zero_one" ,
138- reason = "unsure of placement, wants to use associated constants" ,
139- issue = "27739" ) ]
140- #[ allow( deprecated) ]
141- impl One for $t {
142- #[ inline]
143- fn one( ) -> Self { 1 }
144- }
145- ) * )
146- }
147- zero_one_impl ! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
148-
149- macro_rules! zero_one_impl_float {
150- ( $( $t: ty) * ) => ( $(
151- #[ unstable( feature = "zero_one" ,
152- reason = "unsure of placement, wants to use associated constants" ,
153- issue = "27739" ) ]
154- #[ allow( deprecated) ]
155- impl Zero for $t {
156- #[ inline]
157- fn zero( ) -> Self { 0.0 }
158- }
159- #[ unstable( feature = "zero_one" ,
160- reason = "unsure of placement, wants to use associated constants" ,
161- issue = "27739" ) ]
162- #[ allow( deprecated) ]
163- impl One for $t {
164- #[ inline]
165- fn one( ) -> Self { 1.0 }
166- }
167- ) * )
168- }
169- zero_one_impl_float ! { f32 f64 }
170-
17199macro_rules! checked_op {
172100 ( $U: ty, $op: path, $x: expr, $y: expr) => { {
173101 let ( result, overflowed) = unsafe { $op( $x as $U, $y as $U) } ;
0 commit comments