Skip to content

Commit 5ebd077

Browse files
committed
make it more obvious that the size is not relevant
1 parent bb17f71 commit 5ebd077

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustc_mir/interpret/place.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,10 @@ where
353353
// Offset may need adjustment for unsized fields
354354
let (meta, offset) = if field_layout.is_unsized() {
355355
// re-use parent metadata to determine dynamic field layout
356-
let (_, align) = self.size_and_align_of(base.meta, field_layout)?
357-
// If this is an extern type, we fall back to its static size and alignment.
358-
.unwrap_or_else(|| base.layout.size_and_align());
356+
let align = self.size_and_align_of(base.meta, field_layout)?
357+
.map(|(_, align)| align)
358+
// If this is an extern type, we fall back to its static alignment.
359+
.unwrap_or_else(|| base.layout.align);
359360
(base.meta, offset.abi_align(align))
360361
} else {
361362
// base.meta could be present; we might be accessing a sized field of an unsized

0 commit comments

Comments
 (0)