Erase regions of type in offset_of!

This commit is contained in:
clubby789 2023-05-16 21:36:42 +00:00
parent b652d9a0fd
commit 35cf5726e3
2 changed files with 9 additions and 3 deletions

View File

@ -481,9 +481,10 @@ pub(crate) fn as_rvalue(
}))))
}
ExprKind::OffsetOf { container, fields } => {
block.and(Rvalue::NullaryOp(NullOp::OffsetOf(fields), container))
}
ExprKind::OffsetOf { container, fields } => block.and(Rvalue::NullaryOp(
NullOp::OffsetOf(fields),
this.tcx.erase_regions(container),
)),
ExprKind::Literal { .. }
| ExprKind::NamedConst { .. }

View File

@ -12,6 +12,11 @@ fn main() {
offset_of!(S, f.,); //~ ERROR expected identifier
offset_of!(S, f..); //~ ERROR no rules expected the token
offset_of!(S, f..,); //~ ERROR no rules expected the token
offset_of!(Lt<'static>, bar); // issue #111657
}
struct S { f: u8, }
struct Lt<'a> {
bar: &'a (),
}