Skip to content

Commit f404f33

Browse files
cbeuwoli-obk
andcommitted
Use builtin_index instead of match
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
1 parent e24f5ac commit f404f33

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

compiler/rustc_mir_build/src/build/custom/parse/instruction.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,9 @@ impl<'tcx, 'body> ParseCtxt<'tcx, 'body> {
173173
)
174174
),
175175
ExprKind::Array { fields } => {
176-
let elem_ty = match expr.ty.kind() {
177-
ty::Array(ty, ..) => ty,
178-
_ => unreachable!("ty is array"),
179-
};
176+
let elem_ty = expr.ty.builtin_index().expect("ty must be an array");
180177
Ok(Rvalue::Aggregate(
181-
Box::new(AggregateKind::Array(*elem_ty)),
178+
Box::new(AggregateKind::Array(elem_ty)),
182179
fields.iter().map(|e| self.parse_operand(*e)).collect::<Result<_, _>>()?
183180
))
184181
},

0 commit comments

Comments
 (0)