Skip to content

Commit 1458687

Browse files
Erase regions before calculating layout for packed field capture
1 parent 77497c7 commit 1458687

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_typeck/src/check/upvar.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,8 @@ fn restrict_repr_packed_field_ref_capture<'tcx>(
16391639
match p.kind {
16401640
ProjectionKind::Field(..) => match ty.kind() {
16411641
ty::Adt(def, _) if def.repr.packed() => {
1642-
match tcx.layout_of(param_env.and(p.ty)) {
1642+
// We erase regions here because they cannot be hashed
1643+
match tcx.layout_of(param_env.and(tcx.erase_regions(p.ty))) {
16431644
Ok(layout) if layout.align.abi.bytes() == 1 => {
16441645
// if the alignment is 1, the type can't be further
16451646
// disaligned.

0 commit comments

Comments
 (0)