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 build on stable toolchain #1331

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Lysxia
Copy link
Collaborator

@Lysxia Lysxia commented Jan 28, 2025

Fix #1319 and #1000

I'm not sure what's the right way to deal with Allocator and Step being unstable. For Allocator I've replaced all the impls with one where A is defaulted. For Step I've just removed the impls because there is no "default" here.

@Lysxia Lysxia changed the title Contracts build stable Make creusot-contracts build on stable toolchain Jan 28, 2025
@Lysxia Lysxia force-pushed the contracts-build-stable branch from 6450ffe to 0db0786 Compare January 28, 2025 13:48
@Lysxia Lysxia marked this pull request as ready for review January 28, 2025 13:48
@Lysxia Lysxia force-pushed the contracts-build-stable branch 2 times, most recently from ecd3f36 to 2f461cf Compare January 28, 2025 13:51
Copy link
Collaborator

@xldenis xldenis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step is only needed for extern specs right? if so then its fine to just make it conditional.

@jhjourdan
Copy link
Collaborator

Do we agree that this does not really solves the problem that #[invariant(..)] does not work on stable?

Sure, the user can write #[cfg_attr(creusot, invariant(...))], but this is both ugly and maybe it should be rejected by Rust, because this is still an attribute on a statement...

@xldenis
Copy link
Collaborator

xldenis commented Jan 28, 2025

yes, agreed. but this is still an improvement.

@Lysxia
Copy link
Collaborator Author

Lysxia commented Jan 29, 2025

Do we agree that this does not really solves the problem that #[invariant(..)] does not work on stable?

Yes, I'm working on that, and this PR does not need it.

@Lysxia Lysxia force-pushed the contracts-build-stable branch from 2f461cf to 33b5066 Compare January 29, 2025 10:05
creusot-contracts/src/std/iter/range.rs Show resolved Hide resolved
creusot-contracts/src/std/ops.rs Outdated Show resolved Hide resolved
@Lysxia Lysxia force-pushed the contracts-build-stable branch from dd73036 to 44c8732 Compare January 29, 2025 12:13
@Lysxia
Copy link
Collaborator Author

Lysxia commented Jan 29, 2025

I added the handling of invariant here because testing it depends on this PR anyway, even though the actual changes orthogonal.

@Lysxia Lysxia linked an issue Jan 29, 2025 that may be closed by this pull request
@Lysxia Lysxia force-pushed the contracts-build-stable branch from 2888187 to 1a12462 Compare January 30, 2025 11:49
@Lysxia
Copy link
Collaborator Author

Lysxia commented Jan 30, 2025

I changed the flag from creusot to feature = "nightly" so that we can still use the original impls when building with a nightly rustc. The hacks to approximate those impls are only needed for stable rustc.

@Lysxia
Copy link
Collaborator Author

Lysxia commented Jan 30, 2025

Ready for review.

@Lysxia Lysxia force-pushed the contracts-build-stable branch 3 times, most recently from 4ef952e to 570a4fc Compare February 4, 2025 09:18
@Lysxia Lysxia force-pushed the contracts-build-stable branch from 570a4fc to d89d7ca Compare February 12, 2025 09:13
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 this pull request may close these issues.

Make creusot-contracts buildable with stable rust How to compile modules using Creusot contracts?
3 participants