diff options
| author | George Bateman <george.bateman16@gmail.com> | 2024-04-28 18:36:08 +0100 |
|---|---|---|
| committer | George Bateman <george.bateman16@gmail.com> | 2024-04-28 18:36:08 +0100 |
| commit | ca79086c874278bf362391996be7b49ccf30160a (patch) | |
| tree | 8eb76791edf0f9f6fc1582f14c6c4ffc12c57f84 /library/core/src/mem | |
| parent | 6c90ac8d8f4489472720fce03c338cd5d0977f33 (diff) | |
Fix #124478 - offset_of! returns a temporary
This was due to the must_use() call. Adding HIR's OffsetOf to the must_use checking within the compiler avoids this issue.
Diffstat (limited to 'library/core/src/mem')
| -rw-r--r-- | library/core/src/mem/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 75d42edbaa0..9054ade2d79 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -1340,8 +1340,8 @@ impl<T> SizedTypeProperties for T {} /// assert_eq!(mem::offset_of!(Option<&u8>, Some.0), 0); /// ``` #[stable(feature = "offset_of", since = "1.77.0")] -#[allow_internal_unstable(builtin_syntax, hint_must_use)] +#[allow_internal_unstable(builtin_syntax)] pub macro offset_of($Container:ty, $($fields:expr)+ $(,)?) { // The `{}` is for better error messages - crate::hint::must_use({builtin # offset_of($Container, $($fields)+)}) + {builtin # offset_of($Container, $($fields)+)} } |
