Skip to content

Commit 491172b

Browse files
authored
Rollup merge of rust-lang#110694 - est31:builtin, r=petrochenkov
Implement builtin # syntax and use it for offset_of!(...) Add `builtin #` syntax to the parser, as well as a generic infrastructure to support both item and expression position builtin syntaxes. The PR also uses this infrastructure for the implementation of the `offset_of!` macro, added by rust-lang#106934. cc `@petrochenkov` `@DrMeepster` cc rust-lang#110680 `builtin #` tracking issue cc rust-lang#106655 `offset_of!` tracking issue
2 parents 85cc532 + 7f315a6 commit 491172b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/src/mem/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,9 +1315,9 @@ impl<T> SizedTypeProperties for T {}
13151315
///
13161316
/// assert_eq!(mem::offset_of!(NestedA, b.0), 0);
13171317
/// ```
1318-
#[unstable(feature = "offset_of", issue = "106655")]
1319-
#[rustc_builtin_macro]
13201318
#[cfg(not(bootstrap))]
1319+
#[unstable(feature = "offset_of", issue = "106655")]
1320+
#[allow_internal_unstable(builtin_syntax)]
13211321
pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) {
1322-
/* compiler built-in */
1322+
builtin # offset_of($Container, $($fields).+)
13231323
}

0 commit comments

Comments
 (0)