Skip to content

cargo new --edition 2018? #5980

@japaric

Description

@japaric

cargo new creates a new project for the 2015 edition. If you want to use the 2018 features like not having to type extern crate foo to be able to import foo::bar then you have to add this to your Cargo.toml:

cargo-features = ["edition"]

[package]
edition = "2018"
# ..

Would it make sense to add an --edition flag to cargo new to indicate which edition the project will use? For example, cargo new --edition 2018 would create a project with a Cargo.toml that includes package.edition = "2018"

Please avoid discussing whether cargo new should default to the 2018 edition. That's a separate issue and should be discussed separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions