Skip to content

feat: Add edition for scripts anytime we mutate the manifest#17038

Merged
weihanglo merged 5 commits into
rust-lang:masterfrom
epage:edit-edition
May 28, 2026
Merged

feat: Add edition for scripts anytime we mutate the manifest#17038
weihanglo merged 5 commits into
rust-lang:masterfrom
epage:edit-edition

Conversation

@epage

@epage epage commented May 27, 2026

Copy link
Copy Markdown
Contributor

What does this PR try to resolve?

This is an experiment in finding a middle ground between two opposite perspectives

  • cargo fix resolves the no-edition warning by setting it
  • cargo automatically injects the edition whenever running a cargo script

This is instead "if we're already doing edits, we might as well inject the edition". This is still limited because (1) people or IDEs can do direct edits and (2) cargo add -M script.rs serde is a big more cumbersome than cargo add serde.

We could possibly take this a step further to "all mutations" and include cargo update and cargo generate-lockfile.

This does not include a "pinning" status message at this time.

How to test and review this PR?

@rustbot rustbot added A-manifest Area: Cargo.toml issues Command-add Command-fix Command-remove S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 27, 2026
@rustbot

rustbot commented May 27, 2026

Copy link
Copy Markdown
Collaborator

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, weihanglo

@rustbot

This comment has been minimized.

@rustbot

rustbot commented May 28, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1,4 +1,7 @@
---
[package]
edition = "2024"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when edition 2027 is out we'll need to update these snapshots?

@weihanglo
weihanglo added this pull request to the merge queue May 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 28, 2026
@weihanglo

Copy link
Copy Markdown
Member

linux x86-64 stable

---- ssh::invalid_key_error stdout ----
SSH_AGENT_PID=109572
running `/home/runner/work/cargo/cargo/target/debug/cargo fetch`

thread 'ssh::invalid_key_error' (109569) panicked at tests/testsuite/ssh.rs:372:10:

--- Expected
++++ actual:   stderr
   1    1 | [UPDATING] git repository `ssh://testuser@127.0.0.1:32773/repos/bar.git`
   2    2 | [ERROR] failed to get `bar` as a dependency of package `foo v0.1.0 ([ROOT]/foo)`
   3    3 | 
   4    4 | Caused by:
   5    5 |   failed to load source for dependency `bar`
          ⋮
   9    9 | 
  10   10 | Caused by:
  11   11 |   failed to clone into: [ROOT]/home/.cargo/git/db/bar-[HASH]
  12   12 | 
  13   13 | Caused by:
Error: m  14      -   [ERROR] SSH host key has changed for `[127.0.0.1]:32773`
  15      -   *********************************
  16      -   * WARNING: HOST KEY HAS CHANGED *
  17      -   *********************************
  18      -   This may be caused by a man-in-the-middle attack, or the server may have changed its host key.
       14 +   network failure seems to have happened
       15 +   if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
       16 +   https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
  19   17 | 
  20      -   The ECDSA fingerprint for the key from the remote host is:
  21      -   SHA256:[..]
  22      - 
  23      -   You are strongly encouraged to contact the server administrator for `[127.0.0.1]:32773` to verify that this new key is correct.
  24      - 
  25      -   If you can verify that the server has a new key, you can resolve this error by removing the old ecdsa-sha2-nistp256 key for `[127.0.0.1]:32773` located at [ROOT]/home/.ssh/known_hosts line 1, and adding the new key to the `net.ssh.known-hosts` array in your Cargo configuration (such as [ROOT]/home/.cargo/config.toml) or in your OpenSSH known_hosts file at [ROOT]/home/.ssh/known_hosts
  26      - 
  27      -   The key provided by the remote host is:
  28      - 
  29      -   [127.0.0.1]:32773 ecdsa-sha2-nistp256 [..]
  30      - 
  31      -   See https://doc.rust-lang.org/stable/cargo/appendix/git-authentication.html#ssh-known-hosts for more information.
       18 + Caused by:
       19 +   failed to start SSH session: Failed getting banner; class=Ssh (23)

requeuing

@weihanglo
weihanglo added this pull request to the merge queue May 28, 2026
Merged via the queue into rust-lang:master with commit dbe53f2 May 28, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 28, 2026
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jun 3, 2026
Update cargo submodule

14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958
2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000
- chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060)
- chore(deps): update compatible (rust-lang/cargo#17057)
- fix(util): constant type for Redox OS  (rust-lang/cargo#17064)
- chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059)
- chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058)
- chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054)
- chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049)
- Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048)
- feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038)
- docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036)
- feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025)
- feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033)
- fix(add): Ensure erros are lower case (rust-lang/cargo#17037)
- fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jun 3, 2026
Update cargo submodule

14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958
2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000
- chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060)
- chore(deps): update compatible (rust-lang/cargo#17057)
- fix(util): constant type for Redox OS  (rust-lang/cargo#17064)
- chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059)
- chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058)
- chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054)
- chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049)
- Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048)
- feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038)
- docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036)
- feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025)
- feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033)
- fix(add): Ensure erros are lower case (rust-lang/cargo#17037)
- fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jun 3, 2026
Update cargo submodule

14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958
2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000
- chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060)
- chore(deps): update compatible (rust-lang/cargo#17057)
- fix(util): constant type for Redox OS  (rust-lang/cargo#17064)
- chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059)
- chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058)
- chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054)
- chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049)
- Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048)
- feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038)
- docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036)
- feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025)
- feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033)
- fix(add): Ensure erros are lower case (rust-lang/cargo#17037)
- fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
@rustbot rustbot added this to the 1.98.0 milestone Jun 3, 2026
pull Bot pushed a commit to xtqqczze/rust-lang-rustc-dev-guide that referenced this pull request Jun 4, 2026
Update cargo submodule

14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958
2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000
- chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060)
- chore(deps): update compatible (rust-lang/cargo#17057)
- fix(util): constant type for Redox OS  (rust-lang/cargo#17064)
- chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059)
- chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058)
- chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054)
- chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049)
- Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048)
- feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038)
- docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036)
- feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025)
- feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033)
- fix(add): Ensure erros are lower case (rust-lang/cargo#17037)
- fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
@epage
epage deleted the edit-edition branch June 10, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants