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
This commit is contained in:
commit
664255b168
@ -1648,7 +1648,8 @@ fn restrict_repr_packed_field_ref_capture<'tcx>(
|
|||||||
match p.kind {
|
match p.kind {
|
||||||
ProjectionKind::Field(..) => match ty.kind() {
|
ProjectionKind::Field(..) => match ty.kind() {
|
||||||
ty::Adt(def, _) if def.repr.packed() => {
|
ty::Adt(def, _) if def.repr.packed() => {
|
||||||
match tcx.layout_of(param_env.and(p.ty)) {
|
// We erase regions here because they cannot be hashed
|
||||||
|
match tcx.layout_of(param_env.and(tcx.erase_regions(p.ty))) {
|
||||||
Ok(layout) if layout.align.abi.bytes() == 1 => {
|
Ok(layout) if layout.align.abi.bytes() == 1 => {
|
||||||
// if the alignment is 1, the type can't be further
|
// if the alignment is 1, the type can't be further
|
||||||
// disaligned.
|
// disaligned.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user