@@ -2682,8 +2682,8 @@ pub use num::dec2flt::ParseFloatError;
2682
2682
// Conversions T -> T are covered by a blanket impl and therefore excluded
2683
2683
// Some conversions from and to usize/isize are not implemented due to portability concerns
2684
2684
macro_rules! impl_from {
2685
- ( $Small: ty, $Large: ty) => {
2686
- #[ stable ( feature = "lossless_prim_conv" , since = "1.5.0" ) ]
2685
+ ( $Small: ty, $Large: ty, # [ $attr : meta ] ) => {
2686
+ #[ $attr ]
2687
2687
impl From <$Small> for $Large {
2688
2688
#[ inline]
2689
2689
fn from( small: $Small) -> $Large {
@@ -2694,60 +2694,60 @@ macro_rules! impl_from {
2694
2694
}
2695
2695
2696
2696
// Unsigned -> Unsigned
2697
- impl_from ! { u8 , u16 }
2698
- impl_from ! { u8 , u32 }
2699
- impl_from ! { u8 , u64 }
2700
- impl_from ! { u8 , u128 }
2701
- impl_from ! { u8 , usize }
2702
- impl_from ! { u16 , u32 }
2703
- impl_from ! { u16 , u64 }
2704
- impl_from ! { u16 , u128 }
2705
- impl_from ! { u32 , u64 }
2706
- impl_from ! { u32 , u128 }
2707
- impl_from ! { u64 , u128 }
2697
+ impl_from ! { u8 , u16 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2698
+ impl_from ! { u8 , u32 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2699
+ impl_from ! { u8 , u64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2700
+ impl_from ! { u8 , u128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2701
+ impl_from ! { u8 , usize , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2702
+ impl_from ! { u16 , u32 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2703
+ impl_from ! { u16 , u64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2704
+ impl_from ! { u16 , u128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2705
+ impl_from ! { u32 , u64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2706
+ impl_from ! { u32 , u128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2707
+ impl_from ! { u64 , u128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2708
2708
2709
2709
// Signed -> Signed
2710
- impl_from ! { i8 , i16 }
2711
- impl_from ! { i8 , i32 }
2712
- impl_from ! { i8 , i64 }
2713
- impl_from ! { i8 , i128 }
2714
- impl_from ! { i8 , isize }
2715
- impl_from ! { i16 , i32 }
2716
- impl_from ! { i16 , i64 }
2717
- impl_from ! { i16 , i128 }
2718
- impl_from ! { i32 , i64 }
2719
- impl_from ! { i32 , i128 }
2720
- impl_from ! { i64 , i128 }
2710
+ impl_from ! { i8 , i16 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2711
+ impl_from ! { i8 , i32 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2712
+ impl_from ! { i8 , i64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2713
+ impl_from ! { i8 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2714
+ impl_from ! { i8 , isize , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2715
+ impl_from ! { i16 , i32 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2716
+ impl_from ! { i16 , i64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2717
+ impl_from ! { i16 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2718
+ impl_from ! { i32 , i64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2719
+ impl_from ! { i32 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2720
+ impl_from ! { i64 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2721
2721
2722
2722
// Unsigned -> Signed
2723
- impl_from ! { u8 , i16 }
2724
- impl_from ! { u8 , i32 }
2725
- impl_from ! { u8 , i64 }
2726
- impl_from ! { u8 , i128 }
2727
- impl_from ! { u16 , i32 }
2728
- impl_from ! { u16 , i64 }
2729
- impl_from ! { u16 , i128 }
2730
- impl_from ! { u32 , i64 }
2731
- impl_from ! { u32 , i128 }
2732
- impl_from ! { u64 , i128 }
2723
+ impl_from ! { u8 , i16 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2724
+ impl_from ! { u8 , i32 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2725
+ impl_from ! { u8 , i64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2726
+ impl_from ! { u8 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2727
+ impl_from ! { u16 , i32 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2728
+ impl_from ! { u16 , i64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2729
+ impl_from ! { u16 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2730
+ impl_from ! { u32 , i64 , # [ stable ( feature = "lossless_int_conv" , since = "1.5.0" ) ] }
2731
+ impl_from ! { u32 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2732
+ impl_from ! { u64 , i128 , # [ unstable ( feature = "i128" , issue = "35118" ) ] }
2733
2733
2734
2734
// Note: integers can only be represented with full precision in a float if
2735
2735
// they fit in the significand, which is 24 bits in f32 and 53 bits in f64.
2736
2736
// Lossy float conversions are not implemented at this time.
2737
2737
2738
2738
// Signed -> Float
2739
- impl_from ! { i8 , f32 }
2740
- impl_from ! { i8 , f64 }
2741
- impl_from ! { i16 , f32 }
2742
- impl_from ! { i16 , f64 }
2743
- impl_from ! { i32 , f64 }
2739
+ impl_from ! { i8 , f32 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2740
+ impl_from ! { i8 , f64 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2741
+ impl_from ! { i16 , f32 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2742
+ impl_from ! { i16 , f64 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2743
+ impl_from ! { i32 , f64 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2744
2744
2745
2745
// Unsigned -> Float
2746
- impl_from ! { u8 , f32 }
2747
- impl_from ! { u8 , f64 }
2748
- impl_from ! { u16 , f32 }
2749
- impl_from ! { u16 , f64 }
2750
- impl_from ! { u32 , f64 }
2746
+ impl_from ! { u8 , f32 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2747
+ impl_from ! { u8 , f64 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2748
+ impl_from ! { u16 , f32 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2749
+ impl_from ! { u16 , f64 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2750
+ impl_from ! { u32 , f64 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
2751
2751
2752
2752
// Float -> Float
2753
- impl_from ! { f32 , f64 }
2753
+ impl_from ! { f32 , f64 , # [ stable ( feature = "lossless_float_conv" , since = "1.6.0" ) ] }
0 commit comments