about summary refs log tree commit diff
path: root/library/core
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-11-14 14:47:14 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2021-02-07 20:08:45 +0300
commitdbdbd30bf2cb0d48c8bbce83c2458592664dbb18 (patch)
tree92877e16f45e3cf927ffc4296e0f90c48ec036f5 /library/core
parentae00b62ceb7eaf1f02f5289ab233bf7e0e8060d5 (diff)
downloadrust-dbdbd30bf2cb0d48c8bbce83c2458592664dbb18.tar.gz
rust-dbdbd30bf2cb0d48c8bbce83c2458592664dbb18.zip
expand/resolve: Turn `#[derive]` into a regular macro attribute
Diffstat (limited to 'library/core')
-rw-r--r--library/core/src/macros/mod.rs8
-rw-r--r--library/core/src/prelude/v1.rs5
2 files changed, 13 insertions, 0 deletions
diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs
index 6a7e4b2ba25..7aaf5a5fd46 100644
--- a/library/core/src/macros/mod.rs
+++ b/library/core/src/macros/mod.rs
@@ -1324,6 +1324,14 @@ pub(crate) mod builtin {
         (false) => {{ /* compiler built-in */ }};
     }
 
+    /// Attribute macro used to apply derive macros.
+    #[cfg(not(bootstrap))]
+    #[stable(feature = "rust1", since = "1.0.0")]
+    #[rustc_builtin_macro]
+    pub macro derive($item:item) {
+        /* compiler built-in */
+    }
+
     /// Attribute macro applied to a function to turn it into a unit test.
     #[stable(feature = "rust1", since = "1.0.0")]
     #[allow_internal_unstable(test, rustc_attrs)]
diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs
index b4fff3d67b5..a1fbd8dec75 100644
--- a/library/core/src/prelude/v1.rs
+++ b/library/core/src/prelude/v1.rs
@@ -69,6 +69,11 @@ pub use crate::macros::builtin::{
     bench, global_allocator, test, test_case, RustcDecodable, RustcEncodable,
 };
 
+#[cfg(not(bootstrap))]
+#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
+#[doc(no_inline)]
+pub use crate::macros::builtin::derive;
+
 #[unstable(
     feature = "cfg_accessible",
     issue = "64797",