Make index_by_increasing_offset
return one item for primitives
This commit is contained in:
parent
dcab06d7d2
commit
99213ae164
2 changed files with 8 additions and 12 deletions
|
@ -1271,7 +1271,12 @@ impl<FieldIdx: Idx> FieldsShape<FieldIdx> {
|
|||
}
|
||||
}
|
||||
|
||||
(0..self.count()).map(move |i| match *self {
|
||||
// Primitives don't really have fields in the way that structs do,
|
||||
// but having this return an empty iterator for them is unhelpful
|
||||
// since that makes them look kinda like ZSTs, which they're not.
|
||||
let pseudofield_count = if let FieldsShape::Primitive = self { 1 } else { self.count() };
|
||||
|
||||
(0..pseudofield_count).map(move |i| match *self {
|
||||
FieldsShape::Primitive | FieldsShape::Union(_) | FieldsShape::Array { .. } => i,
|
||||
FieldsShape::Arbitrary { .. } => {
|
||||
if use_small {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue