diff options
| author | Michael Goulet <michael@errs.io> | 2024-11-09 18:21:03 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-11-11 20:53:08 +0000 |
| commit | 8e068b989bdbbf6eeeeee8ca2ba7db50c3e49dfc (patch) | |
| tree | fb8f37ab9beb0eb51f34899a92f7b1d41c68332b /compiler | |
| parent | de27914e8e6c5f8a02698a8ed9b318df17f2f621 (diff) | |
| download | rust-8e068b989bdbbf6eeeeee8ca2ba7db50c3e49dfc.tar.gz rust-8e068b989bdbbf6eeeeee8ca2ba7db50c3e49dfc.zip | |
Recurse into APITs in impl_trait_overcaptures
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/impl_trait_overcaptures.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/impl_trait_overcaptures.rs b/compiler/rustc_lint/src/impl_trait_overcaptures.rs index 036e0381a06..beab4d4e6a9 100644 --- a/compiler/rustc_lint/src/impl_trait_overcaptures.rs +++ b/compiler/rustc_lint/src/impl_trait_overcaptures.rs @@ -262,7 +262,11 @@ where // If it's owned by this function && let opaque = self.tcx.hir_node_by_def_id(opaque_def_id).expect_opaque_ty() - && let hir::OpaqueTyOrigin::FnReturn { parent, .. } = opaque.origin + // We want to recurse into RPITs and async fns, even though the latter + // doesn't overcapture on its own, it may mention additional RPITs + // in its bounds. + && let hir::OpaqueTyOrigin::FnReturn { parent, .. } + | hir::OpaqueTyOrigin::AsyncFn { parent, .. } = opaque.origin && parent == self.parent_def_id { let opaque_span = self.tcx.def_span(opaque_def_id); |
