rust-lang / rust-lang/rust

Cargo script edition policy (lang/edition aspects)

Open
#152,254 50 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-editions C-discussion F-frontmatter I-edition-radar I-lang-radar P-lang-drag-3 T-cargo T-edition T-lang
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

View all comments

Update: For the detailed articulation of this concern, see the document:


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 (https://github.com/rust-lang/cargo/pull/16569).

As part of this, people are raising concerns about this lint and this behavior (see https://github.com/rust-lang/cargo/issues/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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Edition policy for Rust scripting document and RFC 3502, then review cargo issues 12207 and 16598 and the stabilization pull request 16569. Done means reaching and recording a decision on the policy for edition defaults and linting in cargo script, including the roles of the lang and edition teams.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.