Skip to content
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

feat: Stabilize Edition 2024 #14828

Merged
merged 3 commits into from
Nov 25, 2024
Merged

feat: Stabilize Edition 2024 #14828

merged 3 commits into from
Nov 25, 2024

Conversation

epage
Copy link
Contributor

@epage epage commented Nov 15, 2024

What does this PR try to resolve?

How should we test and review this PR?

Additional information

@epage epage marked this pull request as draft November 15, 2024 18:43
@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2024

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

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-unstable Area: nightly unstable support S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 15, 2024
@epage
Copy link
Contributor Author

epage commented Nov 15, 2024

Posting this now to not lose track of the documentation update mentioned in #14754.

@@ -507,7 +507,7 @@ resolver = "2"
- `"2"` ([`edition = "2021"`](manifest.md#the-edition-field) default): Introduces changes in [feature
unification](#features). See the [features chapter][features-2] for more
details.
- `"3"` (requires Rust 1.84+): Change the default for [`resolver.incompatible-rust-versions`] from `allow` to `fallback`
- `"3"` ([`edition = "2024"`](manifest.md#the-edition-field) default, requires Rust 1.84+): Change the default for [`resolver.incompatible-rust-versions`] from `allow` to `fallback`
Copy link
Contributor

@weiznich weiznich Nov 19, 2024

Choose a reason for hiding this comment

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

I would like to point again to RFC-2052 especially to the hard constraints section there:

Warning-free code on edition N must compile on edition N+1 and have the same behavior.

Given that this changes the resolver behavior you can end up in situations that result in broken builds if you specify a minimal supported rust version and a too broad minimal dependency version. That can then result in a changed version resolution to an dependency version which does not contain a public element that is used by the actual crate.

No warning about the possible broken build is emitted with the 2021 edition!

Ed Page pointed out before that this only happens if there is no Cargo.lock file as otherwise dependency resolution is not rerun on edition updates. Also he pointed out that this code is already faulty.

I argue again that neither arguments are valid here as:

  • Projects without Cargo.lock file checked in git repositories where the default at the introduction of the 2021 edition, so cargo must expect that such projects still exists. After all these compile without warning on the latest cargo version
  • A broken minimal dependency version only caused issues with unstable features (-Z minimal-version) in the past, not with any updates (at least as long as the dependency follows semver, but that's assumed as default). So this is a new built-error mode. (Or worded differently the rust compiler itself does also introduce warning periods for similar "fixes")

EDIT: To be clear here, I'm not calling for not stabilizing this feature, I'm just asking for adding the warning required by the RFC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was discussed in #14754 and the Cargo team still checked their boxes and didn't raise a concern to block FCP.

Copy link
Contributor

@weiznich weiznich Nov 19, 2024

Choose a reason for hiding this comment

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

As far as I know the cargo team is responsible for managing cargo. The edition is a language feature, which means the cargo team is not the only responsible team to decide whether something violates the relevant RFC or not.

In addition to that above: Completing the FCP does not change fact that this violates that hard constraint as no such warning is emitted today. I would even argue that this might indicate that the cargo team knowingly decides to violate this RFC and therefore break the given stability guarantees (again).

Copy link
Contributor

Choose a reason for hiding this comment

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

Moderator note: both of you have stated everything there is to it from your perspectives. Further discussion between you two is not fruitful in my opinion. So other cargo team members can chime in, but I would like it if you two refrained from further commentary on this topic unless asked to by cargo team members.

Copy link
Contributor

Choose a reason for hiding this comment

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

The Cargo team discussed these concerns, fully understands these concerns, and does not feel that a change is needed here. We do not think a warning could or should be provided here, due among other reasons to the high likelihood of false positives. We have been carefully considering the ecosystem impact of many different possible approaches to integrating MSRV into the dependency resolver, and we want to highlight that the experience of crate maintainers in many different circumstances has always been our foremost consideration.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ehuss I'm sorry to write that but your response does again not address the core of my concern. So let it me boil down to a simple question:

Which RCF or similar language level decision does exempt the cargo team from the following the rules outlined in RFC-2052?

Can you or a different team member answer this simple question instead of bringing up yet another iteration of excuses why this feature is important or why the given example is already broken.

@ehuss
Copy link
Contributor

ehuss commented Nov 23, 2024

@epage Is this ready to go once nightly is updated tomorrow?

@epage
Copy link
Contributor Author

epage commented Nov 23, 2024

For what I know, yes

@epage
Copy link
Contributor Author

epage commented Nov 24, 2024

@ehuss I realized I forgot to update the functions on Edition. I then tried to update the tests as best as I could because of that. Likely missed stuff.

@ehuss
Copy link
Contributor

ehuss commented Nov 24, 2024

Thanks! Unfortunately it looks like the latest nightly may have failed to publish.

@rustbot rustbot added the A-cli-help Area: built-in command-line help label Nov 24, 2024
epage and others added 3 commits November 25, 2024 09:20
With 2024 stabilized, there will be a "first supported" version which is
above the versions used in tests.

In particular, for the `cargo install` test, we can't test the scenario
until a couple of versions have passed.
We have to rely on Edition 2024 changing ony resolver v3 which is
already covered.
Updating `first_version` is another thing that needs to be checked when
updating.
@epage epage force-pushed the edition2024 branch 2 times, most recently from fe4a8e9 to 81411ec Compare November 25, 2024 15:55
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss marked this pull request as ready for review November 25, 2024 16:29
@ehuss ehuss enabled auto-merge November 25, 2024 16:29
@ehuss ehuss added this pull request to the merge queue Nov 25, 2024
Merged via the queue into rust-lang:master with commit 4c39aaf Nov 25, 2024
22 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 25, 2024
Update cargo and books

10 commits in 66221abdeca2002d318fde6efff516aab091df0e..4c39aaff66862cc0da52fe529aa1990bb8bb9a22
2024-11-19 21:30:02 +0000 to 2024-11-25 16:36:17 +0000
- feat: Stabilize Edition 2024 (rust-lang/cargo#14828)
- Improve error handling when PathSource is relative (rust-lang/cargo#14854)
- test: address test output nondeterminism  (rust-lang/cargo#14855)
- chore: move supports-unicode to workspace deps (rust-lang/cargo#14853)
- Check build target supports std when building with -Zbuild-std=std (rust-lang/cargo#14183)
- fix(publish): Allow dry-run of a non-bumped workspace  (rust-lang/cargo#14847)
- test: Switch from 'exec_with_output' to 'run' (rust-lang/cargo#14848)
- test(rustflags): Verify -Cmetadata directly, not through -Cextra-filename (rust-lang/cargo#14846)
- chore: remove bors mentions (rust-lang/cargo#14845)
- Clarify how `cargo::metadata` env var is selected (rust-lang/cargo#14842)

## nomicon

1 commits in eac89a3cbe6c4714e5029ae8b5a1c556fd4e8c42..0674321898cd454764ab69702819d39a919afd68
2024-11-16 14:05:28 +0000 to 2024-11-19 12:35:48 +0000
- races: Clarify a “mostly” that might be misread (rust-lang/nomicon#468)

## reference

12 commits in 41ccb0e6478305401dad92e8fd3d04a4304edb4c..5c86c739ec71b8bc839310ff47fa94e94635bba9
2024-11-15 21:45:16 +0000 to 2024-11-25 17:23:35 +0000
- Document `gen` keyword as reserved in Rust 2024 (rust-lang/reference#1501)
- 2024: Update `expr` macro fragment specifier (rust-lang/reference#1639)
- Add rust_2024 prelude (rust-lang/reference#1552)
- 2024: Add reserved syntax (rust-lang/reference#1652)
- Add Lifetime Capture Rules 2024 (rust-lang/reference#1601)
- Add a section dedicated to Edition 2024 changes to temporary scopes (rust-lang/reference#1592)
- 2024: Add unsafe attribute differences (rust-lang/reference#1579)
- 2024: Add updates for unsafe extern blocks (rust-lang/reference#1565)
- Fix rule for lazy boolean temporary drop scope (rust-lang/reference#1681)
- Raw lifetimes (rust-lang/reference#1603)
- Fix some missing emdashes (rust-lang/reference#1676)
- Added an additional example of lifetime elision (rust-lang/reference#1678)

## rustc-dev-guide

6 commits in b679e71..787b416
2024-11-18 16:18:15 +0800 to 2024-11-22 11:17:57 +0000
- Remove constants section as it is outdated
- Flatten generic parameter defs section
- Add instructions to test error code docs (rust-lang/rustc-dev-guide#2145)
- Reorganize the "Source Code Representation" chapters (rust-lang/rustc-dev-guide#2142)
- Make `Diag` a clickable link in Suggestion section (rust-lang/rustc-dev-guide#2140)
- update for rustc_intrinsic_const_stable_indirect (rust-lang/rustc-dev-guide#2138)

## edition-guide

6 commits in 915f9b319c2823f310430ecdecd86264a7870d7e..f48b0e842a3911c63240e955d042089e9e0894c7
2024-11-06 07:23:07 +0000 to 2024-11-25 16:20:27 +0000
- Update for 2024 stabilization (rust-lang/edition-guide#338)
- Enable triagebot merge-conflicts and shortcuts (rust-lang/edition-guide#336)
- Organize the 2024 chapters into sub-chapters by category (rust-lang/edition-guide#334)
- Fix broken Cargo Book link in cargo-resolver.md (rust-lang/edition-guide#335)
- Edition 2024 guide for temporary lifetime changes (rust-lang/edition-guide#318)
- 2024: rustfmt sorting (rust-lang/edition-guide#332)
@epage epage deleted the edition2024 branch November 25, 2024 19:30
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 26, 2024
Update cargo and books

10 commits in 66221abdeca2002d318fde6efff516aab091df0e..4c39aaff66862cc0da52fe529aa1990bb8bb9a22
2024-11-19 21:30:02 +0000 to 2024-11-25 16:36:17 +0000
- feat: Stabilize Edition 2024 (rust-lang/cargo#14828)
- Improve error handling when PathSource is relative (rust-lang/cargo#14854)
- test: address test output nondeterminism  (rust-lang/cargo#14855)
- chore: move supports-unicode to workspace deps (rust-lang/cargo#14853)
- Check build target supports std when building with -Zbuild-std=std (rust-lang/cargo#14183)
- fix(publish): Allow dry-run of a non-bumped workspace  (rust-lang/cargo#14847)
- test: Switch from 'exec_with_output' to 'run' (rust-lang/cargo#14848)
- test(rustflags): Verify -Cmetadata directly, not through -Cextra-filename (rust-lang/cargo#14846)
- chore: remove bors mentions (rust-lang/cargo#14845)
- Clarify how `cargo::metadata` env var is selected (rust-lang/cargo#14842)

## nomicon

1 commits in eac89a3cbe6c4714e5029ae8b5a1c556fd4e8c42..0674321898cd454764ab69702819d39a919afd68
2024-11-16 14:05:28 +0000 to 2024-11-19 12:35:48 +0000
- races: Clarify a “mostly” that might be misread (rust-lang/nomicon#468)

## reference

12 commits in 41ccb0e6478305401dad92e8fd3d04a4304edb4c..5c86c739ec71b8bc839310ff47fa94e94635bba9
2024-11-15 21:45:16 +0000 to 2024-11-25 17:23:35 +0000
- Document `gen` keyword as reserved in Rust 2024 (rust-lang/reference#1501)
- 2024: Update `expr` macro fragment specifier (rust-lang/reference#1639)
- Add rust_2024 prelude (rust-lang/reference#1552)
- 2024: Add reserved syntax (rust-lang/reference#1652)
- Add Lifetime Capture Rules 2024 (rust-lang/reference#1601)
- Add a section dedicated to Edition 2024 changes to temporary scopes (rust-lang/reference#1592)
- 2024: Add unsafe attribute differences (rust-lang/reference#1579)
- 2024: Add updates for unsafe extern blocks (rust-lang/reference#1565)
- Fix rule for lazy boolean temporary drop scope (rust-lang/reference#1681)
- Raw lifetimes (rust-lang/reference#1603)
- Fix some missing emdashes (rust-lang/reference#1676)
- Added an additional example of lifetime elision (rust-lang/reference#1678)

## rustc-dev-guide

6 commits in b679e71..787b416
2024-11-18 16:18:15 +0800 to 2024-11-22 11:17:57 +0000
- Remove constants section as it is outdated
- Flatten generic parameter defs section
- Add instructions to test error code docs (rust-lang/rustc-dev-guide#2145)
- Reorganize the "Source Code Representation" chapters (rust-lang/rustc-dev-guide#2142)
- Make `Diag` a clickable link in Suggestion section (rust-lang/rustc-dev-guide#2140)
- update for rustc_intrinsic_const_stable_indirect (rust-lang/rustc-dev-guide#2138)

## edition-guide

6 commits in 915f9b319c2823f310430ecdecd86264a7870d7e..f48b0e842a3911c63240e955d042089e9e0894c7
2024-11-06 07:23:07 +0000 to 2024-11-25 16:20:27 +0000
- Update for 2024 stabilization (rust-lang/edition-guide#338)
- Enable triagebot merge-conflicts and shortcuts (rust-lang/edition-guide#336)
- Organize the 2024 chapters into sub-chapters by category (rust-lang/edition-guide#334)
- Fix broken Cargo Book link in cargo-resolver.md (rust-lang/edition-guide#335)
- Edition 2024 guide for temporary lifetime changes (rust-lang/edition-guide#318)
- 2024: rustfmt sorting (rust-lang/edition-guide#332)
@weihanglo weihanglo added this to the 1.85.0 milestone Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli-help Area: built-in command-line help A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-unstable Area: nightly unstable support S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants