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

How to compile modules using Creusot contracts? #1000

Open
Lysxia opened this issue May 8, 2024 · 6 comments
Open

How to compile modules using Creusot contracts? #1000

Lysxia opened this issue May 8, 2024 · 6 comments
Labels
cargo-creusot Issue is related to the `cargo-creusot` and more generally the porcelain around creusot

Comments

@Lysxia
Copy link
Collaborator

Lysxia commented May 8, 2024

Following the Quickstart in the Creusot guide, I created a src/lib.rs file with some Creusot contracts. cargo creusot succeeds, but cargo build fails because some features are not enabled (which cargo creusot enabled implicitly to succeed). If I enable the features explicitly:

#![feature(stmt_expr_attributes,proc_macro_hygiene)]

Then cargo creusot complains because the features are enabled twice.

One workaround is to enable the feature conditionally:

#![cfg_attr(not(creusot),feature(stmt_expr_attributes,proc_macro_hygiene))]

Am I missing something? Could Creusot not enable those features, or enable them only if they are not already enabled?

@xldenis
Copy link
Collaborator

xldenis commented May 8, 2024

Unfortunately, that's the best way I know of doing things, I suppose the alternative would be for creusot to not enable these features and instead just require all client projects to unconditionally enable them? I'm open to suggestions on this.

@xldenis xldenis added the cargo-creusot Issue is related to the `cargo-creusot` and more generally the porcelain around creusot label Sep 11, 2024
@Lysxia
Copy link
Collaborator Author

Lysxia commented Oct 10, 2024

Yes, I think creusot should let users enable those features unconditionally.

#![feature(stmt_expr_attributes,proc_macro_hygiene)]

@jhjourdan
Copy link
Collaborator

I'd like a macro to generate these automatically each time we are using Creusot.

But here it is said that this is impossible:

https://users.rust-lang.org/t/how-to-generate-top-level-macro-calls-with-a-proc-macro/51142

Sad :'(

@xldenis
Copy link
Collaborator

xldenis commented Oct 10, 2024

The real solution is to just work to stablize these features :P

@jhjourdan
Copy link
Collaborator

I'm not confident that we will never use another unstable feature in the future.

@xldenis
Copy link
Collaborator

xldenis commented Oct 10, 2024

I'm not confident that we will never use another unstable feature in the future.

In our macros? That seems easier to guarantee, in the creusot compiler / contracts sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cargo-creusot Issue is related to the `cargo-creusot` and more generally the porcelain around creusot
Projects
None yet
Development

No branches or pull requests

3 participants