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

add a "future" edition #137606

Merged
merged 1 commit into from
Mar 8, 2025
Merged

add a "future" edition #137606

merged 1 commit into from
Mar 8, 2025

Conversation

davidtwco
Copy link
Member

@davidtwco davidtwco commented Feb 25, 2025

This idea has been discussed previously on Zulip (though what I've implemented isn't exactly the "next"/"future" editions proposed in that message, just the "future" edition). I've found myself prototyping changes that involve edition migrations and wanting to target an upcoming edition for those migrations, but none exists. This should be permanently unstable and not removed.

It's hard to implement edition migrations without having a perma-unstable
"future" edition to target.
@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2025

r? @oli-obk

rustbot has assigned @oli-obk.
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 25, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Feb 25, 2025

cc @rust-lang/edition

@ehuss
Copy link
Contributor

ehuss commented Feb 25, 2025

Can you say more about why any future changes would need to be tied to any edition? The kind of expected development workflow would be to keep new features behind a feature gate. Only when it looks like it is definitely ready to go in the edition would it add edition gates, and only once were are ready to stabilize would the feature gate be removed.

@davidtwco
Copy link
Member Author

Can you say more about why any future changes would need to be tied to any edition? The kind of expected development workflow would be to keep new features behind a feature gate. Only when it looks like it is definitely ready to go in the edition would it add edition gates, and only once were are ready to stabilize would the feature gate be removed.

In rust-lang/rfcs#3729, I describe some edition migrations that the RFC would require - I'm working on an experimental implementation of that RFC, and it's all behind a feature gate like you would expect, but I still want to be able to implement the behaviour for edition N and edition N+1 and write the tests confirming that behaves like it should.

@fmease
Copy link
Member

fmease commented Feb 25, 2025

Quoting ehuss replying to a very similar proposal which was brought forth by me in June '24:

You should be able to land the migration lint behind a feature gate instead of the edition gate. It normally should be a pretty trivial change when it is ready to be accepted in an edition to switch from if features().foo to if features().foo || span.edition().at_least_rust_20xx(), and to update the lint declaration's @future_incompatible field. That can be any time after it has been accepted, which can happen at any time before the edition ships (possibly years).

There's some documentation on doing this in https://rustc-dev-guide.rust-lang.org/guides/editions.html#lints-and-stability.

https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/Edition.20Beyond/near/442314182

@davidtwco
Copy link
Member Author

davidtwco commented Feb 25, 2025

I'm not sure that works in my case, I want to be able to enable the feature to refer to the unstable items it adds to the standard library and test those work with edition N behaviour, and then opt-in to the edition N+1 behaviour and test that.

I guess I could add multiple feature flags instead? But that just feels like it confirms there is a need for this but we just don't want to add it.

@ehuss
Copy link
Contributor

ehuss commented Feb 25, 2025

Hm, I see. Would it be possible to call it something different, like "future"? We don't know what will actually go in the "next" edition, and thus I don't think it is good to make any presumptions about what will be bundled together. It would also be helpful to have a clear warning in the docs to not use the "future" edition unless you have a situation like this were you have two different unstable behaviors that you need to test across an edition boundary1, that this edition marker is permanently unstable2, and that any behavior must also be gated behind a feature gate3? Otherwise I'm concerned that people will actually use this edition marker, which will make testing and tracking difficult and lead to confusion about which edition something is targeted towards.

Would it also be possible to make the prelude changes doc(hidden), since it is permanently unstable?

Footnotes

  1. Otherwise you should just use a regular feature gate.

  2. Once your feature has been accepted into an edition, the feature's code will need to be updated to check the appropriate edition number.

  3. That is, your could should always be tcx.features().my_feature && span.at_least_edition_future()

@davidtwco davidtwco changed the title add a "next" edition add a "future" edition Feb 25, 2025
@davidtwco
Copy link
Member Author

Changed it to "future" and added requested descriptions.

@traviscross traviscross added the T-edition Relevant to the edition team. label Feb 25, 2025
@rust-log-analyzer

This comment has been minimized.

@traviscross traviscross removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 25, 2025
@traviscross
Copy link
Contributor

traviscross commented Feb 25, 2025

This sets something of a process around edition handling, so let's FCP this, which will also give us some time to think it through. On first impression, I had the same concerns as @ehuss. With the changes, it seems probably OK, so:

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Feb 25, 2025

Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Feb 25, 2025
@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Feb 25, 2025
@rfcbot
Copy link

rfcbot commented Feb 25, 2025

🔔 This is now entering its final comment period, as per the review above. 🔔

davidtwco added a commit to davidtwco/rust that referenced this pull request Feb 26, 2025
davidtwco added a commit to davidtwco/rust that referenced this pull request Feb 28, 2025
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 3, 2025
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 3, 2025
This should have been included in rust-lang#137606.
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 3, 2025
This should have been included in rust-lang#137606.
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 6, 2025
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 6, 2025
This should have been included in rust-lang#137606.
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 6, 2025
This should have been included in rust-lang#137606.
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 7, 2025
davidtwco added a commit to davidtwco/rust that referenced this pull request Mar 7, 2025
This should have been included in rust-lang#137606.
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Mar 7, 2025
@rfcbot
Copy link

rfcbot commented Mar 7, 2025

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@traviscross
Copy link
Contributor

@bors r=traviscross,ehuss rollup

@bors
Copy link
Contributor

bors commented Mar 7, 2025

📌 Commit d6bb98e has been approved by traviscross,ehuss

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 7, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 8, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang#137337 (Add verbatim linker to AIXLinker)
 - rust-lang#137363 (compiler: factor Windows x86-32 ABI impl into its own file)
 - rust-lang#137537 (Prevent `rmake.rs` from using unstable features, and fix 3 run-make tests that currently do)
 - rust-lang#137606 (add a "future" edition)
 - rust-lang#137957 (Remove i586-pc-windows-msvc)
 - rust-lang#138000 (atomic: clarify that failing conditional RMW operations are not 'writes')
 - rust-lang#138013 (Add post-merge analysis CI workflow)
 - rust-lang#138033 (rustdoc: Add attribute-related tests for rustdoc JSON.)
 - rust-lang#138137 (setTargetTriple now accepts Triple rather than string)
 - rust-lang#138173 (Delay bug for negative auto trait rather than ICEing)
 - rust-lang#138184 (Allow anyone to relabel `CI-spurious-*`)
 - rust-lang#138187 (remove clones)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4ec8407 into rust-lang:master Mar 8, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 8, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 8, 2025
Rollup merge of rust-lang#137606 - davidtwco:next-edition, r=traviscross,ehuss

add a "future" edition

This idea has been discussed previously [on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Continuous.20edition-like.20changes.3F/near/432559262) (though what I've implemented isn't exactly the "next"/"future" editions proposed in that message, just the "future" edition). I've found myself prototyping changes that involve edition migrations and wanting to target an upcoming edition for those migrations, but none exists. This should be permanently unstable and not removed.
@traviscross traviscross assigned traviscross and unassigned oli-obk Mar 8, 2025
@davidtwco davidtwco deleted the next-edition branch March 8, 2025 10:45
@riking
Copy link

riking commented Mar 9, 2025

There should be an RFC drafted that spells out the process around this, for example:

  • The future edition has worse stability guarantees than nightly: it can not only be broken at any time due to API changes and removals, it can also contain syntax and semantics changes (e.g. when a Rust 2027 syntax change feature is enabled-by-default-in-edition, this means future gets that syntax change!)
  • If work is landed in the future edition but it does not meet the edition quality bar (has completed migration lints, etc) when an edition cutoff occurs, the feature will remain in the future edition.

Started a Zulip topic: #edition>'future' edition policy RFC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-edition Relevant to the edition team. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants