@@ -45,7 +45,8 @@ impl_float_to_int!(f64 => u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize);
45
45
macro_rules! impl_from {
46
46
( $Small: ty, $Large: ty, #[ $attr: meta] , $doc: expr) => {
47
47
#[ $attr]
48
- impl From <$Small> for $Large {
48
+ #[ rustc_const_unstable( feature = "const_num_from_num" , issue = "87852" ) ]
49
+ impl const From <$Small> for $Large {
49
50
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
50
51
// Rustdocs on functions do not.
51
52
#[ doc = $doc]
@@ -172,7 +173,8 @@ impl_from! { f32, f64, #[stable(feature = "lossless_float_conv", since = "1.6.0"
172
173
macro_rules! try_from_unbounded {
173
174
( $source: ty, $( $target: ty) ,* ) => { $(
174
175
#[ stable( feature = "try_from" , since = "1.34.0" ) ]
175
- impl TryFrom <$source> for $target {
176
+ #[ rustc_const_unstable( feature = "const_num_from_num" , issue = "87852" ) ]
177
+ impl const TryFrom <$source> for $target {
176
178
type Error = TryFromIntError ;
177
179
178
180
/// Try to create the target number type from a source
@@ -190,7 +192,8 @@ macro_rules! try_from_unbounded {
190
192
macro_rules! try_from_lower_bounded {
191
193
( $source: ty, $( $target: ty) ,* ) => { $(
192
194
#[ stable( feature = "try_from" , since = "1.34.0" ) ]
193
- impl TryFrom <$source> for $target {
195
+ #[ rustc_const_unstable( feature = "const_num_from_num" , issue = "87852" ) ]
196
+ impl const TryFrom <$source> for $target {
194
197
type Error = TryFromIntError ;
195
198
196
199
/// Try to create the target number type from a source
@@ -212,7 +215,8 @@ macro_rules! try_from_lower_bounded {
212
215
macro_rules! try_from_upper_bounded {
213
216
( $source: ty, $( $target: ty) ,* ) => { $(
214
217
#[ stable( feature = "try_from" , since = "1.34.0" ) ]
215
- impl TryFrom <$source> for $target {
218
+ #[ rustc_const_unstable( feature = "const_num_from_num" , issue = "87852" ) ]
219
+ impl const TryFrom <$source> for $target {
216
220
type Error = TryFromIntError ;
217
221
218
222
/// Try to create the target number type from a source
@@ -234,7 +238,8 @@ macro_rules! try_from_upper_bounded {
234
238
macro_rules! try_from_both_bounded {
235
239
( $source: ty, $( $target: ty) ,* ) => { $(
236
240
#[ stable( feature = "try_from" , since = "1.34.0" ) ]
237
- impl TryFrom <$source> for $target {
241
+ #[ rustc_const_unstable( feature = "const_num_from_num" , issue = "87852" ) ]
242
+ impl const TryFrom <$source> for $target {
238
243
type Error = TryFromIntError ;
239
244
240
245
/// Try to create the target number type from a source
0 commit comments