about summary refs log tree commit diff
path: root/src/libcore/hash
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-07-28 01:51:21 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-08-10 00:05:37 +0300
commitcbcc7dd182b9bf67d664508b82284c5539ef8819 (patch)
tree380086210f82747225b911eb6cc0598b767d0285 /src/libcore/hash
parent534b42394d743511db1335d5ed08d507ab7c6e73 (diff)
Give built-in macros stable addresses in the standard library
Diffstat (limited to 'src/libcore/hash')
-rw-r--r--src/libcore/hash/mod.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 38e38642842..c4cbf40a93a 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -198,6 +198,21 @@ pub trait Hash {
     }
 }
 
+// Separate module to reexport the macro `Hash` from prelude without the trait `Hash`.
+#[cfg(not(bootstrap))]
+pub(crate) mod macros {
+    /// Derive macro generating an impl of the trait `Hash`.
+    #[rustc_builtin_macro]
+    #[rustc_macro_transparency = "semitransparent"]
+    #[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
+    #[allow_internal_unstable(core_intrinsics)]
+    pub macro Hash($item:item) { /* compiler built-in */ }
+}
+#[cfg(not(bootstrap))]
+#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
+#[doc(inline)]
+pub use macros::Hash;
+
 /// A trait for hashing an arbitrary stream of bytes.
 ///
 /// Instances of `Hasher` usually represent state that is changed while hashing