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](8cece636b2 (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.
This commit is contained in:
Matthias Krüger 2024-07-14 10:05:22 +02:00 committed by GitHub
commit 82f13e7215
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 0 deletions

View File

@ -42,6 +42,10 @@ macro_rules! declare_features {
// feature-group-start: accepted features // feature-group-start: accepted features
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Note that the version indicates when it got *stabilized*.
// When moving an unstable feature here, set the version number to
// `CURRENT RUSTC VERSION` with ` ` replaced by `_`.
/// Allows `#[target_feature(...)]` on aarch64 platforms /// Allows `#[target_feature(...)]` on aarch64 platforms
(accepted, aarch64_target_feature, "1.61.0", Some(44839)), (accepted, aarch64_target_feature, "1.61.0", Some(44839)),
/// Allows using the `efiapi` ABI. /// Allows using the `efiapi` ABI.

View File

@ -31,6 +31,10 @@
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Feature { pub struct Feature {
pub name: Symbol, pub name: Symbol,
/// For unstable features: the version the feature was added in.
/// For accepted features: the version the feature got stabilized in.
/// For removed features we are inconsistent; sometimes this is the
/// version it got added, sometimes the version it got removed.
pub since: &'static str, pub since: &'static str,
issue: Option<NonZero<u32>>, issue: Option<NonZero<u32>>,
} }

View File

@ -32,6 +32,12 @@ macro_rules! declare_features {
// feature-group-start: removed features // feature-group-start: removed features
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Note that the version indicates when it got *removed*.
// When moving an unstable feature here, set the version number to
// `CURRENT RUSTC VERSION` with ` ` replaced by `_`.
// (But not all features below do this properly; many indicate the
// version they got originally added in.)
/// Allows using the `amdgpu-kernel` ABI. /// Allows using the `amdgpu-kernel` ABI.
(removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None), (removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None),
(removed, advanced_slice_patterns, "1.0.0", Some(62254), (removed, advanced_slice_patterns, "1.0.0", Some(62254),