From c659cbde30fa37272cf9ab8d00cb05d533a7a06d Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sat, 25 Jul 2026 02:38:59 +0000 Subject: [PATCH] Revert "Export `derive` at `core::derive` and `std::derive`" This reverts commit fec09987324f37dda32c79f12d2d8c342805ae11. --- library/core/src/lib.rs | 2 -- library/core/src/macros/mod.rs | 2 +- library/core/src/prelude/v1.rs | 6 +----- library/std/src/lib.rs | 2 -- library/std/src/prelude/v1.rs | 6 +----- tests/ui/imports/global-derive-path.rs | 10 ---------- 6 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 tests/ui/imports/global-derive-path.rs diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 6e670375fcc5e..c3f52d040d4c5 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -226,8 +226,6 @@ pub mod offload; #[unstable(feature = "contracts", issue = "128044")] pub mod contracts; -#[unstable(feature = "derive_macro_global_path", issue = "154645")] -pub use crate::macros::builtin::derive; #[stable(feature = "cfg_select", since = "1.95.0")] pub use crate::macros::cfg_select; diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index b58d3b7f1f539..d69a5aad4c26b 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1771,7 +1771,7 @@ pub(crate) mod builtin { /// /// See [the reference] for more info. /// - /// [the reference]: ../reference/attributes/derive.html + /// [the reference]: ../../../reference/attributes/derive.html #[stable(feature = "rust1", since = "1.0.0")] #[rustc_builtin_macro] pub macro derive($item:item) { diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index 6122ab12ec351..f2eb047d342bc 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -120,13 +120,9 @@ pub use crate::trace_macros; // (no public module for them to be re-exported from). #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] pub use crate::macros::builtin::{ - alloc_error_handler, bench, global_allocator, test, test_case, + alloc_error_handler, bench, derive, global_allocator, test, test_case, }; -#[stable(feature = "builtin_macro_prelude", since = "1.38.0")] -#[doc(no_inline)] -pub use crate::macros::builtin::derive; - #[unstable(feature = "derive_const", issue = "118304")] pub use crate::macros::builtin::derive_const; diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index e1061af1e7d6d..80ea577acd117 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -750,8 +750,6 @@ pub use core::cfg_select; reason = "`concat_bytes` is not stable enough for use and is subject to change" )] pub use core::concat_bytes; -#[unstable(feature = "derive_macro_global_path", issue = "154645")] -pub use core::derive; #[stable(feature = "matches_macro", since = "1.42.0")] #[allow(deprecated, deprecated_in_future)] pub use core::matches; diff --git a/library/std/src/prelude/v1.rs b/library/std/src/prelude/v1.rs index aeefec8b9e084..ee57e031c959c 100644 --- a/library/std/src/prelude/v1.rs +++ b/library/std/src/prelude/v1.rs @@ -115,13 +115,9 @@ pub use core::prelude::v1::trace_macros; // (no public module for them to be re-exported from). #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] pub use core::prelude::v1::{ - alloc_error_handler, bench, global_allocator, test, test_case, + alloc_error_handler, bench, derive, global_allocator, test, test_case, }; -#[stable(feature = "builtin_macro_prelude", since = "1.38.0")] -#[doc(no_inline)] -pub use core::prelude::v1::derive; - #[unstable(feature = "derive_const", issue = "118304")] pub use core::prelude::v1::derive_const; diff --git a/tests/ui/imports/global-derive-path.rs b/tests/ui/imports/global-derive-path.rs deleted file mode 100644 index 5f0a6bb86bf30..0000000000000 --- a/tests/ui/imports/global-derive-path.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ edition: 2024 -//@ check-pass -#![crate_type = "lib"] -#![feature(derive_macro_global_path)] - -#[::core::derive(Clone)] -struct Y; - -#[::std::derive(Clone)] -struct X;