rustc_codegen_ssa: use project_index
, not project_field
, for array literals.
This commit is contained in:
parent
66c83ffca1
commit
900309ec8a
1 changed files with 6 additions and 1 deletions
|
@ -125,7 +125,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
// Do not generate stores and GEPis for zero-sized fields.
|
// Do not generate stores and GEPis for zero-sized fields.
|
||||||
if !op.layout.is_zst() {
|
if !op.layout.is_zst() {
|
||||||
let field_index = active_field_index.unwrap_or(i);
|
let field_index = active_field_index.unwrap_or(i);
|
||||||
let field = dest.project_field(&mut bx, field_index);
|
let field = if let mir::AggregateKind::Array(_) = **kind {
|
||||||
|
let llindex = bx.cx().const_usize(field_index as u64);
|
||||||
|
dest.project_index(&mut bx, llindex)
|
||||||
|
} else {
|
||||||
|
dest.project_field(&mut bx, field_index)
|
||||||
|
};
|
||||||
op.val.store(&mut bx, field);
|
op.val.store(&mut bx, field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue