Rollup merge of #118802 - ehuss:remove-edition-preview, r=TaKO8Ki

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.
This commit is contained in:
Guillaume Gomez 2023-12-11 11:40:36 +01:00 committed by GitHub
commit 948c9047d5
4 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
// rustfmt-edition: 2015 // rustfmt-edition: 2015
#![feature(rust_2018_preview, uniform_paths)] #![feature(uniform_paths)]
use futures::prelude::*; use futures::prelude::*;
use http_03::cli::Cli; use http_03::cli::Cli;
use hyper::{service::service_fn_ok, Body, Response, Server}; use hyper::{service::service_fn_ok, Body, Response, Server};

View File

@ -1,5 +1,5 @@
// rustfmt-edition: 2018 // rustfmt-edition: 2018
#![feature(rust_2018_preview, uniform_paths)] #![feature(uniform_paths)]
use futures::prelude::*; use futures::prelude::*;
use http_03::cli::Cli; use http_03::cli::Cli;
use hyper::{service::service_fn_ok, Body, Response, Server}; use hyper::{service::service_fn_ok, Body, Response, Server};

View File

@ -1,5 +1,5 @@
// rustfmt-edition: 2015 // rustfmt-edition: 2015
#![feature(rust_2018_preview, uniform_paths)] #![feature(uniform_paths)]
use futures::prelude::*; use futures::prelude::*;
use http_03::cli::Cli; use http_03::cli::Cli;
use hyper::{service::service_fn_ok, Body, Response, Server}; use hyper::{service::service_fn_ok, Body, Response, Server};

View File

@ -1,5 +1,5 @@
// rustfmt-edition: 2018 // rustfmt-edition: 2018
#![feature(rust_2018_preview, uniform_paths)] #![feature(uniform_paths)]
use ::log::{error, info, log}; use ::log::{error, info, log};
use futures::prelude::*; use futures::prelude::*;
use http_03::cli::Cli; use http_03::cli::Cli;