@@ -69,19 +69,21 @@ macro_rules! impl_from {
69
69
) ,
70
70
) ;
71
71
} ;
72
- ( $Small: ty => $Large: ty, #[ $attr: meta] $( , ) ?) => {
72
+ ( $Small: ty => $Large: ty, #[ $attr: meta] $( , # [ $flux_attr : meta ] ) ? $ ( , ) ?) => {
73
73
impl_from!(
74
74
$Small => $Large,
75
75
#[ $attr] ,
76
76
concat!( "Converts [`" , stringify!( $Small) , "`] to [`" , stringify!( $Large) , "`] losslessly." ) ,
77
+ $( #[ $flux_attr] , ) ?
77
78
) ;
78
79
} ;
79
- ( $Small: ty => $Large: ty, #[ $attr: meta] , $doc: expr $( , ) ?) => {
80
+ ( $Small: ty => $Large: ty, #[ $attr: meta] , $doc: expr $( , # [ $flux_attr : meta ] ) ? $ ( , ) ?) => {
80
81
#[ $attr]
81
82
impl From <$Small> for $Large {
82
83
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
83
84
// Rustdocs on functions do not.
84
85
#[ doc = $doc]
86
+ $( #[ $flux_attr] ) ?
85
87
#[ inline( always) ]
86
88
fn from( small: $Small) -> Self {
87
89
small as Self
@@ -109,7 +111,7 @@ impl_from!(u8 => u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")])
109
111
impl_from ! ( u8 => u32 , #[ stable( feature = "lossless_int_conv" , since = "1.5.0" ) ] ) ;
110
112
impl_from ! ( u8 => u64 , #[ stable( feature = "lossless_int_conv" , since = "1.5.0" ) ] ) ;
111
113
impl_from ! ( u8 => u128 , #[ stable( feature = "i128" , since = "1.26.0" ) ] ) ;
112
- impl_from ! ( u8 => usize , #[ stable( feature = "lossless_int_conv" , since = "1.5.0" ) ] ) ;
114
+ impl_from ! ( u8 => usize , #[ stable( feature = "lossless_int_conv" , since = "1.5.0" ) ] , # [ cfg_attr ( flux , flux :: spec ( fn ( x : u8 ) -> usize [ x ] ) ) ] ) ;
113
115
impl_from ! ( u16 => u32 , #[ stable( feature = "lossless_int_conv" , since = "1.5.0" ) ] ) ;
114
116
impl_from ! ( u16 => u64 , #[ stable( feature = "lossless_int_conv" , since = "1.5.0" ) ] ) ;
115
117
impl_from ! ( u16 => u128 , #[ stable( feature = "i128" , since = "1.26.0" ) ] ) ;
0 commit comments