Created
October 10, 2021 18:25
-
-
Save intelliot/b4aa449977632eacd35582f80c0de2c4 to your computer and use it in GitHub Desktop.
Rust cargo build-bpf - feature `edition2021` is required
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cargo build-bpf | |
Failed to obtain package metadata: Error during execution of `cargo metadata`: error: failed to parse manifest at `/Users/elliot/solana/smart-contract/Cargo.toml` | |
Caused by: | |
feature `edition2021` is required | |
The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.55.0 (32da73ab1 2021-08-23)). | |
Consider trying a newer version of Cargo (this may require the nightly release). | |
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature. | |
-- | |
The steps to try out the Rust 2021 Edition as follows (more detailed directions can be found here [1]): | |
Install the most recent nightly: rustup update nightly. | |
Run cargo +nightly fix --edition. | |
Edit Cargo.toml and place cargo-features = ["edition2021"] at the top (above [package]), and change the edition field to say edition = "2021". | |
Run cargo +nightly check to verify it now works in the new edition. | |
[1] https://doc.rust-lang.org/nightly/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The real fix for this is to upgrade Rust to 1.56 or later. Do not add
cargo-features
anywhere — that is an outdated advice.