1
Fork 0

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.
This commit is contained in:
George Bateman 2024-04-28 18:36:08 +01:00
parent 6c90ac8d8f
commit ca79086c87
No known key found for this signature in database
GPG key ID: C417AA9C4039EFCF
7 changed files with 28 additions and 26 deletions

View file

@ -176,6 +176,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
| hir::BinOpKind::Shr => Some("bitwise operation"),
},
hir::ExprKind::AddrOf(..) => Some("borrow"),
hir::ExprKind::OffsetOf(..) => Some("`offset_of` call"),
hir::ExprKind::Unary(..) => Some("unary operation"),
_ => None,
};