Rollup merge of #152554 - JonathanBrouwer:remove_deprecated_safe, r=jdonszelmann

Remove `deprecated_safe` and its corresponding feature gate

This unimplements the feature gate for tracking issue https://github.com/rust-lang/rust/issues/94978
The author of that tracking issue and the MCP seem to no longer exist
Afaik we can just do this, but let me know if I'm wrong

Because this feature has been idle for 3+ years, and it is in the way to finish the attribute refactoring (https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163)
When someone wants to do work on it the feature gate can be re-added

r? @jdonszelmann
This commit is contained in:
Jonathan Brouwer 2026-02-13 13:35:03 +01:00 committed by GitHub
commit 1944af691e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 2 additions and 41 deletions

View file

@ -862,13 +862,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
register_tool, CrateLevel, template!(List: &["tool1, tool2, ..."]), DuplicatesOk,
EncodeCrossCrate::No, experimental!(register_tool),
),
// lang-team MCP 147
gated!(
deprecated_safe, Normal, template!(List: &[r#"since = "version", note = "...""#]), ErrorFollowing,
EncodeCrossCrate::Yes, experimental!(deprecated_safe),
),
// `#[cfi_encoding = ""]`
gated!(
cfi_encoding, Normal, template!(NameValueStr: "encoding"), ErrorPreceding,

View file

@ -102,6 +102,8 @@ declare_features! (
/// Allows default type parameters to influence type inference.
(removed, default_type_parameter_fallback, "1.82.0", Some(27336),
Some("never properly implemented; requires significant design work"), 127655),
/// Allows using `#[deprecated_safe]` to deprecate the safeness of a function or trait
(removed, deprecated_safe, "CURRENT_RUSTC_VERSION", Some(94978), Some("never properly implemented, in the way of attribute refactor"), 152554),
/// Allows deriving traits as per `SmartPointer` specification
(removed, derive_smart_pointer, "1.84.0", Some(123430), Some("replaced by `CoercePointee`"), 131284),
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.

View file

@ -454,8 +454,6 @@ declare_features! (
/// Allows the use of default values on struct definitions and the construction of struct
/// literals with the functional update syntax without a base.
(unstable, default_field_values, "1.85.0", Some(132162)),
/// Allows using `#[deprecated_safe]` to deprecate the safeness of a function or trait
(unstable, deprecated_safe, "1.61.0", Some(94978)),
/// Allows having using `suggestion` in the `#[deprecated]` attribute.
(unstable, deprecated_suggestion, "1.61.0", Some(94785)),
/// Allows deref patterns.

View file

@ -393,8 +393,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
| sym::warn
| sym::deny
| sym::forbid
// need to be fixed
| sym::deprecated_safe // FIXME(deprecated_safe)
// internal
| sym::panic_handler
| sym::lang

View file

@ -1,7 +0,0 @@
#[deprecated_safe(since = "TBD", note = "...")] //~ ERROR: the `#[deprecated_safe]` attribute is an experimental feature
unsafe fn deprecated_safe_fn() {}
#[deprecated_safe(since = "TBD", note = "...")] //~ ERROR: the `#[deprecated_safe]` attribute is an experimental feature
unsafe trait DeprecatedSafeTrait {}
fn main() {}

View file

@ -1,23 +0,0 @@
error[E0658]: the `#[deprecated_safe]` attribute is an experimental feature
--> $DIR/feature-gate-deprecated_safe.rs:1:1
|
LL | #[deprecated_safe(since = "TBD", note = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #94978 <https://github.com/rust-lang/rust/issues/94978> for more information
= help: add `#![feature(deprecated_safe)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: the `#[deprecated_safe]` attribute is an experimental feature
--> $DIR/feature-gate-deprecated_safe.rs:4:1
|
LL | #[deprecated_safe(since = "TBD", note = "...")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #94978 <https://github.com/rust-lang/rust/issues/94978> for more information
= help: add `#![feature(deprecated_safe)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.