Skip to content

Commit

Permalink
remark about the one place where place computation calls size_and_ali…
Browse files Browse the repository at this point in the history
…gn_of
  • Loading branch information
RalfJung committed Feb 21, 2019
1 parent 0f6d363 commit b01f81b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustc_mir/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,11 @@ where
// above). In that case, all fields are equal.
let field_layout = base.layout.field(self, usize::try_from(field).unwrap_or(0))?;

// Offset may need adjustment for unsized fields
// Offset may need adjustment for unsized fields.
let (meta, offset) = if field_layout.is_unsized() {
// re-use parent metadata to determine dynamic field layout
// Re-use parent metadata to determine dynamic field layout.
// With custom DSTS, this *will* execute user-defined code, but the same
// happens at run-time so that's okay.
let align = match self.size_and_align_of(base.meta, field_layout)? {
Some((_, align)) => align,
None if offset == Size::ZERO =>
Expand Down

0 comments on commit b01f81b

Please sign in to comment.