Skip to content

Commit cdb3355

Browse files
committed
expand/resolve: Turn #[derive] into a regular macro attribute
1 parent 7acc086 commit cdb3355

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

core/src/macros/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,14 @@ pub(crate) mod builtin {
13241324
(false) => {{ /* compiler built-in */ }};
13251325
}
13261326

1327+
/// Attribute macro used to apply derive macros.
1328+
#[cfg(not(bootstrap))]
1329+
#[stable(feature = "rust1", since = "1.0.0")]
1330+
#[rustc_builtin_macro]
1331+
pub macro derive($item:item) {
1332+
/* compiler built-in */
1333+
}
1334+
13271335
/// Attribute macro applied to a function to turn it into a unit test.
13281336
#[stable(feature = "rust1", since = "1.0.0")]
13291337
#[allow_internal_unstable(test, rustc_attrs)]

core/src/prelude/v1.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ pub use crate::macros::builtin::{
6969
bench, global_allocator, test, test_case, RustcDecodable, RustcEncodable,
7070
};
7171

72+
#[cfg(not(bootstrap))]
73+
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
74+
#[doc(no_inline)]
75+
pub use crate::macros::builtin::derive;
76+
7277
#[unstable(
7378
feature = "cfg_accessible",
7479
issue = "64797",

std/src/prelude/v1.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ pub use core::prelude::v1::{
5454
bench, global_allocator, test, test_case, RustcDecodable, RustcEncodable,
5555
};
5656

57+
#[cfg(not(bootstrap))]
58+
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
59+
#[doc(hidden)]
60+
pub use core::prelude::v1::derive;
61+
5762
#[unstable(
5863
feature = "cfg_accessible",
5964
issue = "64797",

0 commit comments

Comments
 (0)