about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2023-12-11 11:40:36 +0100
committerGitHub <noreply@github.com>2023-12-11 11:40:36 +0100
commit54d6bded3015e778481dd2889e2cf5e190433b28 (patch)
tree6b35512b0e8d12602dcac45d050a4912701db2c8 /src/tools
parent8b1ba11cb1176cd7b8a0f4b55d1c97ee9fd3662d (diff)
parentf481596ee4e761182f20eaf1b67d4431cd2d5556 (diff)
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.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/rustfmt/tests/source/issue-2927-2.rs2
-rw-r--r--src/tools/rustfmt/tests/source/issue-2927.rs2
-rw-r--r--src/tools/rustfmt/tests/target/issue-2927-2.rs2
-rw-r--r--src/tools/rustfmt/tests/target/issue-2927.rs2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/tools/rustfmt/tests/source/issue-2927-2.rs b/src/tools/rustfmt/tests/source/issue-2927-2.rs
index d87761fdc9c..07afef38cf5 100644
--- a/src/tools/rustfmt/tests/source/issue-2927-2.rs
+++ b/src/tools/rustfmt/tests/source/issue-2927-2.rs
@@ -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};
diff --git a/src/tools/rustfmt/tests/source/issue-2927.rs b/src/tools/rustfmt/tests/source/issue-2927.rs
index a7df32084f3..c7ec7bb0855 100644
--- a/src/tools/rustfmt/tests/source/issue-2927.rs
+++ b/src/tools/rustfmt/tests/source/issue-2927.rs
@@ -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};
diff --git a/src/tools/rustfmt/tests/target/issue-2927-2.rs b/src/tools/rustfmt/tests/target/issue-2927-2.rs
index e895783ba8b..46e0bf0e989 100644
--- a/src/tools/rustfmt/tests/target/issue-2927-2.rs
+++ b/src/tools/rustfmt/tests/target/issue-2927-2.rs
@@ -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};
diff --git a/src/tools/rustfmt/tests/target/issue-2927.rs b/src/tools/rustfmt/tests/target/issue-2927.rs
index 3267be28d7b..56afc2d3e40 100644
--- a/src/tools/rustfmt/tests/target/issue-2927.rs
+++ b/src/tools/rustfmt/tests/target/issue-2927.rs
@@ -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;