-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
cargo new --edition 2018
?
#5980
Comments
alexcrichton
added a commit
to alexcrichton/cargo
that referenced
this issue
Sep 6, 2018
This commit stabilizes the `edition` key in `Cargo.toml`, both in the `[package]` section and inside subtargets. Additionally the `cargo new` and `cargo init` subcommands have been enhanced with a `--edition` flag to allow explicitly specifying the edition to be generated. This commit does not yet change the default edition that's generated. Closes rust-lang#5980
bors
added a commit
that referenced
this issue
Sep 6, 2018
Stabilize `edition` key and add `cargo new --edition` This commit stabilizes the `edition` key in `Cargo.toml`, both in the `[package]` section and inside subtargets. Additionally the `cargo new` and `cargo init` subcommands have been enhanced with a `--edition` flag to allow explicitly specifying the edition to be generated. This commit does not yet change the default edition that's generated. Closes #5980
bors bot
added a commit
to rust-embedded/embedonomicon
that referenced
this issue
Sep 14, 2018
19: move code to the 2018 edition r=japaric a=japaric most code changes are minor the annoying part of using the 2018 edition right now is that there is no easy way to create new 2018 project (Cargo still defaults to 2015 projects; see rust-lang/cargo#5980) and there's no visible documentation on how to move a new project to the 2018 edition (see rust-lang/edition-guide#102) so I have included the required changes in the preface -- I hope people won't miss that part. r? @rust-embedded/resources (anyone) closes #1 Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Does this flag in Cargo.toml change how your crate is used as a dependency? AKA, does specifying |
@MggMuggins Dependencies will use the edition that they declare, regardless of the edition in your root package. It should be safe to use 2018 dependencies in a 2015 package. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cargo new
creates a new project for the 2015 edition. If you want to use the 2018 features like not having to typeextern crate foo
to be able to importfoo::bar
then you have to add this to your Cargo.toml:Would it make sense to add an
--edition
flag tocargo new
to indicate which edition the project will use? For example,cargo new --edition 2018
would create a project with a Cargo.toml that includespackage.edition = "2018"
Please avoid discussing whether
cargo new
should default to the 2018 edition. That's a separate issue and should be discussed separately.The text was updated successfully, but these errors were encountered: