about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorGeorge Bateman <george.bateman16@gmail.com>2024-01-02 22:12:35 +0000
committerGeorge Bateman <george.bateman16@gmail.com>2024-01-02 22:18:35 +0000
commit09bb07e38f5bfba4fa3e9ac3113e6b7e542e7c67 (patch)
treeaffa65a7c263c446beb5071cf6432a9b97624dcb /library/core/src
parente51e98dde6a60637b6a71b8105245b629ac3fe77 (diff)
downloadrust-09bb07e38f5bfba4fa3e9ac3113e6b7e542e7c67.tar.gz
rust-09bb07e38f5bfba4fa3e9ac3113e6b7e542e7c67.zip
Make offset_of field parsing use metavariable which handles any spacing
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/mem/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs
index c1687abb7cb..407954001e4 100644
--- a/library/core/src/mem/mod.rs
+++ b/library/core/src/mem/mod.rs
@@ -1395,8 +1395,18 @@ impl<T> SizedTypeProperties for T {}
 ///
 /// assert_eq!(mem::offset_of!(Option<&u8>, Some.0), 0);
 /// ```
+#[cfg(not(bootstrap))]
 #[unstable(feature = "offset_of", issue = "106655")]
 #[allow_internal_unstable(builtin_syntax, hint_must_use)]
+pub macro offset_of($Container:ty, $($fields:expr)+ $(,)?) {
+    // The `{}` is for better error messages
+    crate::hint::must_use({builtin # offset_of($Container, $($fields)+)})
+}
+
+#[cfg(bootstrap)]
+#[unstable(feature = "offset_of", issue = "106655")]
+#[allow_internal_unstable(builtin_syntax, hint_must_use)]
+#[allow(missing_docs)]
 pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) {
     // The `{}` is for better error messages
     crate::hint::must_use({builtin # offset_of($Container, $($fields).+)})