Skip to content

Cargo script edition policy (lang/edition aspects) #152254

@traviscross

Description

@traviscross

In the @rust-lang/cargo team RFC for cargo script (RFC 3502), the document stated a policy that when the edition is not specified in the frontmatter, cargo script will use the latest edition, whatever that is, while linting about this. Cargo script is now up for stabilization (rust-lang/cargo#16569).

As part of this, people are raising concerns about this lint and this behavior (see rust-lang/cargo#16598).

In some sense, the only fixed decisions at the time of stabilization are 1) that cargo script will work without an edition set and 2) that it will use Rust 2024 by default. We could always later decide to never change the default from Rust 2024. Due to that, if we're all happy with these two decisions (I am), I think it's OK for the stabilization to proceed. No need to block that.

But I do want to mention, as a policy matter for what happens in the next edition, that I think the @rust-lang/lang and @rust-lang/edition teams are stakeholders in this.

From an edition side, Cargo changing a default over an edition represents an edition change; I'd expect this to be an edition item.

From a lang side, for my part, I believe the language that we choose to put in front of people "using Rust™" is a lang team matter, and I think that people using cargo script will feel that they're "using Rust™". If we update the edition of Rust automatically when someone updates the toolchain, then this would make our story that editions only cause breakage in an opt-in way less true (some might say untrue). Further, breakage in scripts will not be caught by crater and so will be difficult to predict confidently.

I'd be concerned that these factors would eventually constrain our ability to use editions in the intended way to evolve the language.

As mentioned, I don't believe this needs to block the cargo script stabilization as the edition policy can be worked out later, but I do want to raise the matter for awareness in case anyone feels something about this policy matter might affect anything about the stabilization.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-editionsArea: Related to editions collectively or in general (i.e., the mechanism itself).C-discussionCategory: Discussion or questions that doesn't represent real issues.F-frontmatter`#![feature(frontmatter)]`I-edition-nominatedNominated for discussion during an edition team meeting.I-lang-nominatedNominated for discussion during a lang team meeting.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langT-cargoRelevant to the cargo team, which will review and decide on the PR/issue.T-editionRelevant to the edition team.T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions