I am experiencing an issue when using cargo-contract (version 1.5.1) to build a project (command: cargo +nightly contract build
). The specified toolchain is not being recognized, and the process is forcibly calling nightly-2022-06-30 instead.
This occurs on both my M2 MacOS and Ubuntu (within the Windows11 WSL environment), suggesting that the problem is likely not device-dependent. I have followed the installation instructions as outlined in Astar Doc's Ink! Environment (https://docs.astar.network/docs/build/environment/ink_environment/).
The issue surfaces when building a flipper created by cargo contract new flipper. Interestingly, the problem does not occur when I install cargo-contract V2, suggesting that the issue might specifically be with V1.5.1.
There are no elements that could potentially influence the toolchain specification (such as environment variables or specification via the rust-toolchain file). Even after uninstalling nightly-2022-06-30 using rustup toolchain uninstall, the process still attempts to call this version.
Here is the corresponding log:
yasuyasu@mocomocha:~/astar/flipper$ cargo +nightly contract build
2023-05-13T12:50:30.989598Z INFO cargo_contract::crate_metadata: Fetching cargo metadata for Cargo.toml
2023-05-13T12:50:31.050626Z INFO cargo_contract::util: Invoking cargo: "/home/yasuyasu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "tree" "-i" "parity-scale-codec" "--duplicates"
2023-05-13T12:50:31.070036Z INFO cargo_contract::util: Invoking cargo: "/home/yasuyasu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "tree" "-i" "scale-info" "--duplicates"
2023-05-13T12:50:31.088857Z INFO cargo_contract::cmd::build: Contract version: Version { major: 3, minor: 4, patch: 0 }
[1/5] Checking ink! linting rules
2023-05-13T12:50:31.113119Z INFO cargo_contract::util: Invoking cargo: cd "/home/yasuyasu/astar/flipper" && DYLINT_LIBRARY_PATH="/tmp/cargo-contract-dylint_CAz4e7" "/home/yasuyasu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "dylint" "--lib" "ink_linting" "--manifest-path=/home/yasuyasu/astar/flipper/Cargo.toml"
Checking with toolchain `nightly-2022-06-30-x86_64-unknown-linux-gnu`
Checking scale-info v2.6.0
error[E0658]: `let...else` statements are unstable
--> /home/yasuyasu/.cargo/registry/src/github.com-1ecc6299db9ec823/scale-info-2.6.0/src/portable.rs:130:17
|
130 | / let Some(ty) = ¶m.ty else {
131 | | continue
132 | | };
| |__________________^
|
= note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
= help: add `#![feature(let_else)]` to the crate attributes to enable
For more information about this error, try `rustc --explain E0658`.
error: could not compile `scale-info` due to previous error
Error: Compilation failed with toolchain `nightly-2022-06-30-x86_64-unknown-linux-gnu`
Caused by:
command failed: CLIPPY_DISABLE_DOCS_LINKS="null" DYLINT_LIBS="[\"/tmp/cargo-contract-dylint_CAz4e7/libink_linting@nightly-2022-06-30-x86_64-unknown-linux-gnu.so\"]" RUSTC_WORKSPACE_WRAPPER="/home/yasuyasu/.dylint_drivers/nightly-2022-06-30-x86_64-unknown-linux-gnu/dylint-driver" RUSTUP_TOOLCHAIN="nightly-2022-06-30-x86_64-unknown-linux-gnu" "cargo" "check" "--target-dir" "/home/yasuyasu/astar/flipper/target/dylint/target/nightly-2022-06-30-x86_64-unknown-linux-gnu" "--manifest-path" "/home/yasuyasu/astar/flipper/Cargo.toml"
ERROR: `cd "/home/yasuyasu/astar/flipper" && DYLINT_LIBRARY_PATH="/tmp/cargo-contract-dylint_CAz4e7" "/home/yasuyasu/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "dylint" "--lib" "ink_linting" "--manifest-path=/home/yasuyasu/astar/flipper/Cargo.toml"` failed with exit code: Some(1)
yasuyasu@mocomocha:~/astar/flipper$
WASM_BUILD_TOOLCHAIN
env var?export WASM_BUILD_TOOLCHAIN=nightly-2023-01-01
But result was same.. In this line of log, I don't know why check is carried out by nightly-2022-06-30[1/5] Checking ink! linting rules 2023-05-13T14:42:50.667586Z INFO cargo_contract::util: Invoking cargo: cd "/Users/yasuyasu/hack/astar/develop/flipper" && DYLINT_LIBRARY_PATH="/var/folders/jr/8pgwdjss1k148znsrq610j800000gn/T/cargo-contract-dylint_Mcn2A3" "/Users/yasuyasu/.rustup/toolchains/nightly-2023-01-01-aarch64-apple-darwin/bin/cargo" "dylint" "--lib" "ink_linting" "--manifest-path=/Users/yasuyasu/hack/astar/develop/flipper/Cargo.toml" Checking with toolchain
nightly-2022-06-30-aarch64-apple-darwin`rustup override set nightly-2023-01-01-x86_64-unknown-linux-gnu && rustup show
+nightly
to use a different version? (i.e. what is the output ofls -al /home/yasuyasu/.rustup/toolchains
? note: i had a similar issue because i was doing this github.com/ltfschoen/InkTemplate/blob/main/docker/run.sh#L74. what was the output of runningrustc +nightly version