diff --git a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs index e60e1a4c81507..adbd37a7cd950 100644 --- a/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs +++ b/compiler/rustc_mir_build/src/build/custom/parse/instruction.rs @@ -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::>()? )) },