Skip to content

Commit

Permalink
Rollup merge of rust-lang#118802 - ehuss:remove-edition-preview, r=Ta…
Browse files Browse the repository at this point in the history
…KO8Ki

Remove edition umbrella features.

In the 2018 edition, there was an "umbrella" feature `#[feature(rust_2018_preview)]` which was used to enable several other features at once. This umbrella mechanism was not used in the 2021 edition and likely will not be used in 2024 either. During 2018 users reported that setting the feature was awkward, especially since they already needed to opt-in via the edition mechanism.

This PR removes this mechanism because I believe it will not be used (and will clean up and simplify the code). I believe that there are better ways to handle features and editions. In short:

- For highly experimental features, that may or may not be involved in an edition, they can implement regular feature gates like `tcx.features().my_feature`.
- For experimental features that *might* be involved in an edition, they should implement gates with `tcx.features().my_feature && span.at_least_rust_20xx()`. This requires the user to still specify `#![feature(my_feature)]`, to avoid disrupting testing of other edition features which are ready and have been accepted within the edition.
- For experimental features that have graduated to definitely be part of an edition, they should implement gates with `tcx.features().my_feature || span.at_least_rust_20xx()`, or just remove the feature check altogether and just check `span.at_least_rust_20xx()`.
- For relatively simple changes, they can skip the whole feature gating thing and just check `span.at_least_rust_20xx()`, and rely on the instability of the edition itself (which requires `-Zunstable-options`) to gate it.

I am working on documenting all of this in the rustc-dev-guide.
  • Loading branch information
GuillaumeGomez authored Dec 11, 2023
2 parents 1cb804b + b9ad024 commit 948c904
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/source/issue-2927-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// rustfmt-edition: 2015
#![feature(rust_2018_preview, uniform_paths)]
#![feature(uniform_paths)]
use futures::prelude::*;
use http_03::cli::Cli;
use hyper::{service::service_fn_ok, Body, Response, Server};
Expand Down
2 changes: 1 addition & 1 deletion tests/source/issue-2927.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// rustfmt-edition: 2018
#![feature(rust_2018_preview, uniform_paths)]
#![feature(uniform_paths)]
use futures::prelude::*;
use http_03::cli::Cli;
use hyper::{service::service_fn_ok, Body, Response, Server};
Expand Down
2 changes: 1 addition & 1 deletion tests/target/issue-2927-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// rustfmt-edition: 2015
#![feature(rust_2018_preview, uniform_paths)]
#![feature(uniform_paths)]
use futures::prelude::*;
use http_03::cli::Cli;
use hyper::{service::service_fn_ok, Body, Response, Server};
Expand Down
2 changes: 1 addition & 1 deletion tests/target/issue-2927.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// rustfmt-edition: 2018
#![feature(rust_2018_preview, uniform_paths)]
#![feature(uniform_paths)]
use ::log::{error, info, log};
use futures::prelude::*;
use http_03::cli::Cli;
Expand Down

0 comments on commit 948c904

Please sign in to comment.