Warn on unused offset_of!() result
This commit is contained in:
parent
d7dcadc597
commit
592844cf88
13 changed files with 333 additions and 135 deletions
|
@ -1317,7 +1317,8 @@ impl<T> SizedTypeProperties for T {}
|
|||
/// assert_eq!(mem::offset_of!(NestedA, b.0), 0);
|
||||
/// ```
|
||||
#[unstable(feature = "offset_of", issue = "106655")]
|
||||
#[allow_internal_unstable(builtin_syntax)]
|
||||
#[allow_internal_unstable(builtin_syntax, hint_must_use)]
|
||||
pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) {
|
||||
builtin # offset_of($Container, $($fields).+)
|
||||
// The `{}` is for better error messages
|
||||
crate::hint::must_use({builtin # offset_of($Container, $($fields).+)})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue