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

Error when building contract - error[E0158]: associated consts cannot be referenced in patterns #745

Closed
CrommVardek opened this issue Sep 15, 2022 · 3 comments

Comments

@CrommVardek
Copy link

CrommVardek commented Sep 15, 2022

Hello,

From the flipper example, when executing cargo +nightly contract build the following error is thrown :

error[E0158]: associated consts cannot be referenced in patterns

    |
9  | /     pub struct Flipper {
10 | |         value: bool,
11 | |     }
   | |_____^

cargo --version returns cargo 1.63.0 (fd9c4297c 2022-07-01)
cargo +nightly -V returns cargo 1.65.0-nightly (082503982 2022-09-13)
rustc --version returns rustc 1.63.0 (4b91a6ea7 2022-08-08)
and cargo contract -V return cargo-contract 1.5.0-unknown-x86_64-unknown-linux-gnu

the issue have been reported multiple times on Substrate.StackExchange (here, here and here )

Although a workaround have been explained https://substrate.stackexchange.com/a/4847/151, to me it's still a bug, and I don't understand why it does not work as it's supposed to?

@kayabaNerve
Copy link

This only stopped working in a recent Rust nightly. I'm not sure if Rust nightly tightened, or if Rust nightly had a regression. Regardless, I hope to see this resolved.

@abhijeetbhagat
Copy link

faced the same error today. workaround linked did the trick, although, i had to download the latest binaryen and replace system package mgr installed version.

@xgreenx
Copy link
Collaborator

xgreenx commented Sep 27, 2022

It is problem with the generated code in the ink! use-ink/ink#1417

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

No branches or pull requests

5 participants