make it more obvious that the size is not relevant

This commit is contained in:
Ralf Jung 2018-11-05 11:14:21 +01:00
parent bb17f71749
commit 5ebd077f54

View file

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