@@ -128,6 +128,13 @@ macro_rules! test_impl_from {
128
128
}
129
129
}
130
130
131
+ macro_rules! test_impl_from_cond {
132
+ ( $fn_name: ident, $Small: ty, $Large: ty | $( $width: expr) ,* ) => {
133
+ #[ cfg( any( $( target_pointer_width = $width, ) * ) ) ]
134
+ test_impl_from! { $fn_name, $Small, $Large }
135
+ }
136
+ }
137
+
131
138
// Unsigned -> Unsigned
132
139
test_impl_from ! { test_u8u16, u8 , u16 }
133
140
test_impl_from ! { test_u8u32, u8 , u32 }
@@ -136,6 +143,12 @@ test_impl_from! { test_u8usize, u8, usize }
136
143
test_impl_from ! { test_u16u32, u16 , u32 }
137
144
test_impl_from ! { test_u16u64, u16 , u64 }
138
145
test_impl_from ! { test_u32u64, u32 , u64 }
146
+ test_impl_from_cond ! { test_u16usize, u16 , usize | "16" , "32" , "64" }
147
+ test_impl_from_cond ! { test_u32usize, u32 , usize | "32" , "64" }
148
+ test_impl_from_cond ! { test_u64usize, u64 , usize | "64" }
149
+ test_impl_from_cond ! { test_usizeu16, usize , u16 | "16" }
150
+ test_impl_from_cond ! { test_usizeu32, usize , u32 | "16" , "32" }
151
+ test_impl_from_cond ! { test_usizeu64, usize , u64 | "16" , "32" , "64" }
139
152
140
153
// Signed -> Signed
141
154
test_impl_from ! { test_i8i16, i8 , i16 }
@@ -145,6 +158,12 @@ test_impl_from! { test_i8isize, i8, isize }
145
158
test_impl_from ! { test_i16i32, i16 , i32 }
146
159
test_impl_from ! { test_i16i64, i16 , i64 }
147
160
test_impl_from ! { test_i32i64, i32 , i64 }
161
+ test_impl_from_cond ! { test_i16isize, i16 , isize | "16" , "32" , "64" }
162
+ test_impl_from_cond ! { test_i32isize, i32 , isize | "32" , "64" }
163
+ test_impl_from_cond ! { test_i64isize, i64 , isize | "64" }
164
+ test_impl_from_cond ! { test_isizei16, isize , i16 | "16" }
165
+ test_impl_from_cond ! { test_isizei32, isize , i32 | "16" , "32" }
166
+ test_impl_from_cond ! { test_isizei64, isize , i64 | "16" , "32" , "64" }
148
167
149
168
// Unsigned -> Signed
150
169
test_impl_from ! { test_u8i16, u8 , i16 }
@@ -153,6 +172,11 @@ test_impl_from! { test_u8i64, u8, i64 }
153
172
test_impl_from ! { test_u16i32, u16 , i32 }
154
173
test_impl_from ! { test_u16i64, u16 , i64 }
155
174
test_impl_from ! { test_u32i64, u32 , i64 }
175
+ test_impl_from_cond ! { test_u8isize, u8 , isize | "16" , "32" , "64" }
176
+ test_impl_from_cond ! { test_u16isize, u16 , isize | "32" , "64" }
177
+ test_impl_from_cond ! { test_u32isize, u32 , isize | "64" }
178
+ test_impl_from_cond ! { test_isizeu32, usize , i32 | "16" }
179
+ test_impl_from_cond ! { test_isizeu64, usize , i64 | "16" , "32" }
156
180
157
181
// Signed -> Float
158
182
test_impl_from ! { test_i8f32, i8 , f32 }
0 commit comments