Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make creusot-contracts buildable with stable rust #1319

Open
Lysxia opened this issue Jan 17, 2025 · 4 comments · May be fixed by #1331
Open

Make creusot-contracts buildable with stable rust #1319

Lysxia opened this issue Jan 17, 2025 · 4 comments · May be fixed by #1331

Comments

@Lysxia
Copy link
Collaborator

Lysxia commented Jan 17, 2025

A problem that @arnaudgolfouse just mentioned to me is that we can't yet build creusot-contracts with a stable rust toolchain.

That seems desirable to make it easy to get started with Creusot on an existing stable Rust project, or even to get started with Creusot at all, since the alternative is to be stuck with nightlies or for users to mess with compile-time configuration to hide creusot-contracts from stable builds.

@jhjourdan
Copy link
Collaborator

Could you please list what is blocking here?

@xldenis
Copy link
Collaborator

xldenis commented Jan 17, 2025

Most likely the proc_macro_hygiene and stmt_expr_attributes features?

@Lysxia
Copy link
Collaborator Author

Lysxia commented Jan 17, 2025

Compilation fails first because #![feature] itself is not available on stable compilers:

#![feature(
step_trait,
allocator_api,
unboxed_closures,
tuple_trait,
strict_provenance,
panic_internals,
libstd_sys_internals,
rt,
never_type,
ptr_metadata
)]
#![cfg_attr(not(creusot), feature(rustc_attrs))]

If I comment those out to see what is needed on a first pass, most error messages (45 out of 68) come from allocator_api, because we use the unstable Allocator trait:

error[E0658]: use of unstable library feature 'allocator_api'
   --> /home/sam/rust/creusot/creusot-contracts/src/std/vec.rs:215:52
    |
215 | impl<T, A: Allocator> IntoIterator for &mut Vec<T, A> {
    |                                                 ---^
    |                                                 |
    |                                                 help: consider wrapping the inner types in tuple: `(T, A)`
    |
    = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information

Interestingly, I don't see any error related to proc_macro_hygiene and stmt_expr_attributes because there are no loop invariants in creusot-contracts.

Of the remaining 23 error messages...

  • 7 about tuple_trait:

    error[E0658]: use of unstable library feature 'tuple_trait'
      --> /home/sam/rust/creusot/creusot-contracts/src/std/ops.rs:11:27
       |
    11 | pub trait FnOnceExt<Args: Tuple> {
       |                           ^^^^^
    
  • 5 about step_trait (but 2 exist only on my branch with DoubleEndedIterator):

    error[E0658]: use of unstable library feature 'step_trait'
     --> /home/sam/rust/creusot/creusot-contracts/src/std/iter/range.rs:9:42
      |
    9 | impl<Idx: DeepModel<DeepModelTy = Int> + Step> Iterator for Range<Idx> {
      |                                          ^^^^
      |
    
  • 5 about "compiler internals" (maybe feature rt or rustc_attrs?)

    error[E0658]: diagnostic items compiler internal support for linting
      --> /home/sam/rust/creusot/creusot-contracts/src/ghost.rs:66:5
       |
    66 |     #[rustc_diagnostic_item = "ghost_box_deref"]
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
  • 4 about unboxed_closures

    error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
      --> /home/sam/rust/creusot/creusot-contracts/src/std/ops.rs:90:22
       |
    90 | impl<Args: Tuple, F: FnMut<Args>> FnMutExt<Args> for F {
       |                      ^^^^^^^^^^^ help: use parenthetical notation instead: `FnMut(Args) -> ()`
       |
    
  • 1 about panic_internals

    error[E0658]: use of unstable library feature 'panic_internals': internal details of the implementation of the `panic!` and related macros
     --> /home/sam/rust/creusot/creusot-contracts/src/std/panicking.rs:3:9
      |
    3 | pub use ::core::panicking::*;
      |         ^^^^^^^^^^^^^^^^^
    
  • 1 about never_type

    error[E0658]: the `!` type is experimental
     --> /home/sam/rust/creusot/creusot-contracts/src/invariant.rs:9:20
      |
    9 | impl Invariant for ! {
      |                    ^
    

That doesn't seem too tricky to resolve.

@xldenis
Copy link
Collaborator

xldenis commented Jan 17, 2025

Oh yea this all seems pretty easy to handle then.

@Lysxia Lysxia linked a pull request Jan 28, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants