Skip to content

Commit e4bedab

Browse files
Simplify Flux contract for int conversion (#416)
Update the version of Flux and simplify contracts for int conversion as discussed in #403 (comment). Note that this also includes an update in Flux to the toolchain version matching the one in verify-rust-std, which should fix [this CI failure](https://github.com/model-checking/verify-rust-std/actions/runs/16326340547/job/46117341963). Our PR became out of sync between toolchain updates. We apologize for that! --------- Co-authored-by: Ranjit Jhala <rjhala@ucsd.edu>
1 parent 15b5665 commit e4bedab

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

.github/workflows/flux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
env:
1111
FIXPOINT_VERSION: "556104ba5508891c357b0bdf819ce706e93d9349"
12-
FLUX_VERSION: "192362760b73ea517d0349f7167661a02175b24f"
12+
FLUX_VERSION: "844e2fc0caa6aa96d72f2fcb627a27bf2495d82e"
1313

1414
jobs:
1515
check-flux-on-core:

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)