Skip to content

Commit

Permalink
Erase regions before calculating layout for packed field capture
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Dec 24, 2021
1 parent 77497c7 commit 1458687
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/rustc_typeck/src/check/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,8 @@ fn restrict_repr_packed_field_ref_capture<'tcx>(
match p.kind {
ProjectionKind::Field(..) => match ty.kind() {
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 => {
// if the alignment is 1, the type can't be further
// disaligned.
Expand Down

0 comments on commit 1458687

Please sign in to comment.