Skip to content

Commit 664255b

Browse files
authored
Rollup merge of #92242 - compiler-errors:layout-modulo-regions, r=matthewjasper
Erase regions before calculating layout for packed field capture Self-explanatory. We just erase region inferencing because we don't need that for layout computation... Q: layouts are always equal modulo regions, right? Fixes #92240
2 parents e646f3d + 1458687 commit 664255b

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
@@ -1648,7 +1648,8 @@ fn restrict_repr_packed_field_ref_capture<'tcx>(
16481648
match p.kind {
16491649
ProjectionKind::Field(..) => match ty.kind() {
16501650
ty::Adt(def, _) if def.repr.packed() => {
1651-
match tcx.layout_of(param_env.and(p.ty)) {
1651+
// We erase regions here because they cannot be hashed
1652+
match tcx.layout_of(param_env.and(tcx.erase_regions(p.ty))) {
16521653
Ok(layout) if layout.align.abi.bytes() == 1 => {
16531654
// if the alignment is 1, the type can't be further
16541655
// disaligned.

0 commit comments

Comments
 (0)