mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Use builtin_index instead of match
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
This commit is contained in:
parent
e24f5ac56b
commit
f404f33c21
@ -173,12 +173,9 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
|
||||
)
|
||||
),
|
||||
ExprKind::Array { fields } => {
|
||||
let elem_ty = match expr.ty.kind() {
|
||||
ty::Array(ty, ..) => ty,
|
||||
_ => unreachable!("ty is array"),
|
||||
};
|
||||
let elem_ty = expr.ty.builtin_index().expect("ty must be an array");
|
||||
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<_, _>>()?
|
||||
))
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user