about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/pat.rs
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-01-06 17:58:57 +0100
committerNadrieril <nadrieril+git@gmail.com>2024-01-06 18:03:13 +0100
commit50b197c6ee0c42df56020bd4c5d8e393411fb8c0 (patch)
tree6a22a1a7b1e9f73b42285bd1ab85bc68d2ca0901 /compiler/rustc_pattern_analysis/src/pat.rs
parentd40f1b1172b646d12a340a5b913a363678bc4cd6 (diff)
downloadrust-50b197c6ee0c42df56020bd4c5d8e393411fb8c0.tar.gz
rust-50b197c6ee0c42df56020bd4c5d8e393411fb8c0.zip
Reuse `ctor_sub_tys` when we have one around
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/pat.rs')
-rw-r--r--compiler/rustc_pattern_analysis/src/pat.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_pattern_analysis/src/pat.rs b/compiler/rustc_pattern_analysis/src/pat.rs
index db41d2824a1..4438d20a357 100644
--- a/compiler/rustc_pattern_analysis/src/pat.rs
+++ b/compiler/rustc_pattern_analysis/src/pat.rs
@@ -81,10 +81,11 @@ impl<'p, Cx: TypeCx> DeconstructedPat<'p, Cx> {
         &self,
         pcx: &PlaceCtxt<'_, 'p, Cx>,
         other_ctor: &Constructor<Cx>,
+        ctor_sub_tys: &[Cx::Ty],
     ) -> SmallVec<[&'p DeconstructedPat<'p, Cx>; 2]> {
         let wildcard_sub_tys = || {
-            let tys = pcx.ctor_sub_tys(other_ctor);
-            tys.iter()
+            ctor_sub_tys
+                .iter()
                 .map(|ty| DeconstructedPat::wildcard(*ty))
                 .map(|pat| pcx.mcx.wildcard_arena.alloc(pat) as &_)
                 .collect()