Skip to content

Commit 205b1c1

Browse files
ranjitjhalanilehmann
authored andcommitted
update convert with cast (only)
1 parent f25d4d8 commit 205b1c1

File tree

1 file changed

+4
-5
lines changed
  • library/core/src/convert

1 file changed

+4
-5
lines changed

library/core/src/convert/num.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,20 @@ macro_rules! impl_from {
6969
),
7070
);
7171
};
72-
($Small:ty => $Large:ty, #[$attr:meta] $(, #[$flux_attr:meta])? $(,)?) => {
72+
($Small:ty => $Large:ty, #[$attr:meta] $(,)?) => {
7373
impl_from!(
7474
$Small => $Large,
7575
#[$attr],
7676
concat!("Converts [`", stringify!($Small), "`] to [`", stringify!($Large), "`] losslessly."),
77-
$(#[$flux_attr],)?
7877
);
7978
};
80-
($Small:ty => $Large:ty, #[$attr:meta], $doc:expr $(, #[$flux_attr:meta])? $(,)?) => {
79+
($Small:ty => $Large:ty, #[$attr:meta], $doc:expr $(,)?) => {
8180
#[$attr]
8281
impl From<$Small> for $Large {
8382
// Rustdocs on the impl block show a "[+] show undocumented items" toggle.
8483
// Rustdocs on functions do not.
8584
#[doc = $doc]
86-
$(#[$flux_attr])?
85+
#[cfg_attr(flux, flux::spec(fn(small:$Small) -> $Large[cast(small)]))]
8786
#[inline(always)]
8887
fn from(small: $Small) -> Self {
8988
small as Self
@@ -111,7 +110,7 @@ impl_from!(u8 => u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")])
111110
impl_from!(u8 => u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
112111
impl_from!(u8 => u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
113112
impl_from!(u8 => u128, #[stable(feature = "i128", since = "1.26.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+
impl_from!(u8 => usize, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
115114
impl_from!(u16 => u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
116115
impl_from!(u16 => u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")]);
117116
impl_from!(u16 => u128, #[stable(feature = "i128", since = "1.26.0")]);

0 commit comments

Comments
 (0)