Skip to content

Commit 82f13e7

Browse files
authored
Rollup merge of #127710 - RalfJung:features, r=compiler-errors
clarify the meaning of the version number for accepted/removed features For accepted features this is pretty clear, we even use the version number in the warning that says "feature has been stabilized, please remove feature gate". For removed features we are inconsistent. [This PR](8cece63#diff-a82bdbaaa3c79096a30755dce8896aaf2885128a7f3f3a290072b767f05b6095) set the version to when it got removed, but [here](https://github.com/rust-lang/rust/pull/116958/files#diff-1ff08f89ad7e972538827e989fa63732c5918b4d0216ccd921de08698d6e18ca) they just got copied over so the version says when the feature was originally added. As far as I can tell, this version number is not actually used anywhere in user-visible diagnostics.
2 parents dba010d + 2dd5369 commit 82f13e7

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

compiler/rustc_feature/src/accepted.rs

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ declare_features! (
4242
// feature-group-start: accepted features
4343
// -------------------------------------------------------------------------
4444

45+
// Note that the version indicates when it got *stabilized*.
46+
// When moving an unstable feature here, set the version number to
47+
// `CURRENT RUSTC VERSION` with ` ` replaced by `_`.
48+
4549
/// Allows `#[target_feature(...)]` on aarch64 platforms
4650
(accepted, aarch64_target_feature, "1.61.0", Some(44839)),
4751
/// Allows using the `efiapi` ABI.

compiler/rustc_feature/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ use std::num::NonZero;
3131
#[derive(Debug, Clone)]
3232
pub struct Feature {
3333
pub name: Symbol,
34+
/// For unstable features: the version the feature was added in.
35+
/// For accepted features: the version the feature got stabilized in.
36+
/// For removed features we are inconsistent; sometimes this is the
37+
/// version it got added, sometimes the version it got removed.
3438
pub since: &'static str,
3539
issue: Option<NonZero<u32>>,
3640
}

compiler/rustc_feature/src/removed.rs

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ declare_features! (
3232
// feature-group-start: removed features
3333
// -------------------------------------------------------------------------
3434

35+
// Note that the version indicates when it got *removed*.
36+
// When moving an unstable feature here, set the version number to
37+
// `CURRENT RUSTC VERSION` with ` ` replaced by `_`.
38+
// (But not all features below do this properly; many indicate the
39+
// version they got originally added in.)
40+
3541
/// Allows using the `amdgpu-kernel` ABI.
3642
(removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None),
3743
(removed, advanced_slice_patterns, "1.0.0", Some(62254),

0 commit comments

Comments
 (0)