Skip to content

Commit 9a8f117

Browse files
committed
Don't create the array type twice
1 parent 1ead476 commit 9a8f117

File tree

1 file changed

+4
-6
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+4
-6
lines changed

compiler/rustc_hir_typeck/src/expr.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1526,13 +1526,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15261526

15271527
self.check_repeat_element_needs_copy_bound(element, count, element_ty);
15281528

1529-
self.register_wf_obligation(
1530-
Ty::new_array_with_const_len(tcx, t, count).into(),
1531-
expr.span,
1532-
traits::WellFormed(None),
1533-
);
1529+
let ty = Ty::new_array_with_const_len(tcx, t, count);
1530+
1531+
self.register_wf_obligation(ty.into(), expr.span, traits::WellFormed(None));
15341532

1535-
Ty::new_array_with_const_len(tcx, t, count)
1533+
ty
15361534
}
15371535

15381536
fn check_repeat_element_needs_copy_bound(

0 commit comments

Comments
 (0)