diff options
| author | bors <bors@rust-lang.org> | 2024-01-25 09:20:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-01-25 09:20:22 +0000 |
| commit | 5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c (patch) | |
| tree | c2377bd46c3a4a0ae0479913f2e203ff8466fb81 /compiler/rustc_pattern_analysis/src/usefulness.rs | |
| parent | d93feccb35183fa66fee77e7a2c9d4bf4d01695c (diff) | |
| parent | 8c1ba5931c30b5102fa30202b44ba2a8c40f565e (diff) | |
| download | rust-5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c.tar.gz rust-5bd5d214effd494f4bafb29b3a7a2f6c2070ca5c.zip | |
Auto merge of #120335 - matthiaskrgr:rollup-2a0y3rd, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #119305 (Add `AsyncFn` family of traits) - #119389 (Provide more context on recursive `impl` evaluation overflow) - #119895 (Remove `track_errors` entirely) - #120230 (Assert that a single scope is passed to `for_scope`) - #120278 (Remove --fatal-warnings on wasm targets) - #120292 (coverage: Dismantle `Instrumentor` and flatten span refinement) - #120315 (On E0308 involving `dyn Trait`, mention trait objects) - #120317 (pattern_analysis: Let `ctor_sub_tys` return any Iterator they want) - #120318 (pattern_analysis: Reuse most of the `DeconstructedPat` `Debug` impl) - #120325 (rustc_data_structures: use either instead of itertools) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/usefulness.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/usefulness.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_pattern_analysis/src/usefulness.rs b/compiler/rustc_pattern_analysis/src/usefulness.rs index d7852a2b2cb..0de48c9f3c0 100644 --- a/compiler/rustc_pattern_analysis/src/usefulness.rs +++ b/compiler/rustc_pattern_analysis/src/usefulness.rs @@ -750,7 +750,10 @@ impl<'a, Cx: TypeCx> PlaceCtxt<'a, Cx> { pub(crate) fn ctor_arity(&self, ctor: &Constructor<Cx>) -> usize { self.mcx.tycx.ctor_arity(ctor, self.ty) } - pub(crate) fn ctor_sub_tys(&self, ctor: &Constructor<Cx>) -> &[Cx::Ty] { + pub(crate) fn ctor_sub_tys( + &'a self, + ctor: &'a Constructor<Cx>, + ) -> impl Iterator<Item = Cx::Ty> + ExactSizeIterator + Captures<'a> { self.mcx.tycx.ctor_sub_tys(ctor, self.ty) } pub(crate) fn ctors_for_ty(&self) -> Result<ConstructorSet<Cx>, Cx::Error> { @@ -1058,8 +1061,7 @@ impl<'p, Cx: TypeCx> Matrix<'p, Cx> { ) -> Matrix<'p, Cx> { let ctor_sub_tys = pcx.ctor_sub_tys(ctor); let arity = ctor_sub_tys.len(); - let specialized_place_ty = - ctor_sub_tys.iter().chain(self.place_ty[1..].iter()).cloned().collect(); + let specialized_place_ty = ctor_sub_tys.chain(self.place_ty[1..].iter().cloned()).collect(); let ctor_sub_validity = self.place_validity[0].specialize(ctor); let specialized_place_validity = std::iter::repeat(ctor_sub_validity) .take(arity) |
