😽

ink! のFlipperでビルド時にE0158が発生する場合の対処法

2022/10/20に公開

備忘録として作成。

問題

ink!のquick-start
https://use.ink/getting-started/creating-an-ink-project
に従ってFlipperをcargo-contract ver1.5.0でビルドしたところ下記のエラー E0158が発生。

cargo contract -V 
cargo-contract 1.5.0-unknown-aarch64-apple-darwin
cargo contract new flipper
cargo +nightly contract test


error[E0158]: associated consts cannot be referenced in patterns
  --> lib.rs:8:5
   |
8  | /     /// Defines the storage of your contract.
9  | |     /// Add new fields to the below struct in order
10 | |     /// to add new static storage fields to your contract.
11 | |     #[ink(storage)]
...  |
14 | |         value: bool,
15 | |     }
   | |_____^

For more information about this error, try `rustc --explain E0158`.
error: could not compile `flipper` due to previous error

対処

rust nightly-2022-08-15 をインストールする。

rustup toolchain install nightly-2022-08-15
rustup target add wasm32-unknown-unknown --toolchain nightly-2022-08-15
rustup component add rust-src --toolchain nightly-2022-08-15
cargo +nightly-2022-08-15 contract build

Discussion