Skip to content

Commit

Permalink
don't check in arrays, to give smallvec users some time
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 4, 2019
1 parent 90908b8 commit 321f9e2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/librustc_target/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,11 @@ impl<'a, Ty> TyLayout<'a, Ty> {

match inner.fields {
FieldPlacement::Union(..) => true, // An all-0 unit is fine.
FieldPlacement::Array { count, .. } =>
count == 0 || // 0-length arrays are always okay.
inner.field(cx, 0).to_result()?.might_permit_zero_init(cx)?,
FieldPlacement::Array { .. } =>
// FIXME: The widely use smallvec 0.6 creates uninit arrays
// with any element type, so let us not (yet) complain about that.
// count == 0 || inner.field(cx, 0).to_result()?.might_permit_zero_init(cx)?
true,
FieldPlacement::Arbitrary { ref offsets, .. } =>
// Check that all fields accept zero-init.
(0..offsets.len()).try_fold(true, |accu, idx|
Expand Down

0 comments on commit 321f9e2

Please sign in to comment.