Skip to content

Commit fec0998

Browse files
committed
Export derive at core::derive and std::derive
1 parent 23903d0 commit fec0998

6 files changed

Lines changed: 25 additions & 3 deletions

File tree

library/core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ pub mod autodiff {
227227
#[unstable(feature = "contracts", issue = "128044")]
228228
pub mod contracts;
229229

230+
#[unstable(feature = "derive_macro_global_path", issue = "154645")]
231+
pub use crate::macros::builtin::derive;
230232
#[stable(feature = "cfg_select", since = "1.95.0")]
231233
pub use crate::macros::cfg_select;
232234

library/core/src/macros/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ pub(crate) mod builtin {
17201720
///
17211721
/// See [the reference] for more info.
17221722
///
1723-
/// [the reference]: ../../../reference/attributes/derive.html
1723+
/// [the reference]: ../reference/attributes/derive.html
17241724
#[stable(feature = "rust1", since = "1.0.0")]
17251725
#[rustc_builtin_macro]
17261726
pub macro derive($item:item) {

library/core/src/prelude/v1.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,13 @@ pub use crate::trace_macros;
120120
// (no public module for them to be re-exported from).
121121
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
122122
pub use crate::macros::builtin::{
123-
alloc_error_handler, bench, derive, global_allocator, test, test_case,
123+
alloc_error_handler, bench, global_allocator, test, test_case,
124124
};
125125

126+
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
127+
#[doc(no_inline)]
128+
pub use crate::macros::builtin::derive;
129+
126130
#[unstable(feature = "derive_const", issue = "118304")]
127131
pub use crate::macros::builtin::derive_const;
128132

library/std/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ pub use core::cfg_select;
704704
reason = "`concat_bytes` is not stable enough for use and is subject to change"
705705
)]
706706
pub use core::concat_bytes;
707+
#[unstable(feature = "derive_macro_global_path", issue = "154645")]
708+
pub use core::derive;
707709
#[stable(feature = "matches_macro", since = "1.42.0")]
708710
#[allow(deprecated, deprecated_in_future)]
709711
pub use core::matches;

library/std/src/prelude/v1.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,13 @@ pub use core::prelude::v1::trace_macros;
115115
// (no public module for them to be re-exported from).
116116
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
117117
pub use core::prelude::v1::{
118-
alloc_error_handler, bench, derive, global_allocator, test, test_case,
118+
alloc_error_handler, bench, global_allocator, test, test_case,
119119
};
120120

121+
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
122+
#[doc(no_inline)]
123+
pub use core::prelude::v1::derive;
124+
121125
#[unstable(feature = "derive_const", issue = "118304")]
122126
pub use core::prelude::v1::derive_const;
123127

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ edition: 2024
2+
//@ check-pass
3+
#![crate_type = "lib"]
4+
#![feature(derive_macro_global_path)]
5+
6+
#[::core::derive(Clone)]
7+
struct Y;
8+
9+
#[::std::derive(Clone)]
10+
struct X;

0 commit comments

Comments
 (0)