Use builtin_index instead of match
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
This commit is contained in:
parent
e24f5ac56b
commit
f404f33c21
1 changed files with 2 additions and 5 deletions
|
@ -173,12 +173,9 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
ExprKind::Array { fields } => {
|
ExprKind::Array { fields } => {
|
||||||
let elem_ty = match expr.ty.kind() {
|
let elem_ty = expr.ty.builtin_index().expect("ty must be an array");
|
||||||
ty::Array(ty, ..) => ty,
|
|
||||||
_ => unreachable!("ty is array"),
|
|
||||||
};
|
|
||||||
Ok(Rvalue::Aggregate(
|
Ok(Rvalue::Aggregate(
|
||||||
Box::new(AggregateKind::Array(*elem_ty)),
|
Box::new(AggregateKind::Array(elem_ty)),
|
||||||
fields.iter().map(|e| self.parse_operand(*e)).collect::<Result<_, _>>()?
|
fields.iter().map(|e| self.parse_operand(*e)).collect::<Result<_, _>>()?
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue