Skip to content

Commit e8ee49d

Browse files
committed
Make offset_of field parsing use metavariable which handles any spacing
1 parent a9ad638 commit e8ee49d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/src/mem/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,8 +1395,18 @@ impl<T> SizedTypeProperties for T {}
13951395
///
13961396
/// assert_eq!(mem::offset_of!(Option<&u8>, Some.0), 0);
13971397
/// ```
1398+
#[cfg(not(bootstrap))]
13981399
#[unstable(feature = "offset_of", issue = "106655")]
13991400
#[allow_internal_unstable(builtin_syntax, hint_must_use)]
1401+
pub macro offset_of($Container:ty, $($fields:expr)+ $(,)?) {
1402+
// The `{}` is for better error messages
1403+
crate::hint::must_use({builtin # offset_of($Container, $($fields)+)})
1404+
}
1405+
1406+
#[cfg(bootstrap)]
1407+
#[unstable(feature = "offset_of", issue = "106655")]
1408+
#[allow_internal_unstable(builtin_syntax, hint_must_use)]
1409+
#[allow(missing_docs)]
14001410
pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) {
14011411
// The `{}` is for better error messages
14021412
crate::hint::must_use({builtin # offset_of($Container, $($fields).+)})

0 commit comments

Comments
 (0)