diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-01-15 15:49:58 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-01-15 15:49:58 +0000 |
| commit | 9a8f117d7b20e5503b8499112c26076cbbf570eb (patch) | |
| tree | 94a64f9b77b32b6ceebfe159548f1f071b00d7d6 | |
| parent | 1ead4761e9e2f056385768614c23ffa7acb6a19e (diff) | |
| download | rust-9a8f117d7b20e5503b8499112c26076cbbf570eb.tar.gz rust-9a8f117d7b20e5503b8499112c26076cbbf570eb.zip | |
Don't create the array type twice
| -rw-r--r-- | compiler/rustc_hir_typeck/src/expr.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index af47455c16d..a08f36ddfda 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -1526,13 +1526,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.check_repeat_element_needs_copy_bound(element, count, element_ty); - self.register_wf_obligation( - Ty::new_array_with_const_len(tcx, t, count).into(), - expr.span, - traits::WellFormed(None), - ); + let ty = Ty::new_array_with_const_len(tcx, t, count); + + self.register_wf_obligation(ty.into(), expr.span, traits::WellFormed(None)); - Ty::new_array_with_const_len(tcx, t, count) + ty } fn check_repeat_element_needs_copy_bound( |
