Recurse into APITs in impl_trait_overcaptures

This commit is contained in:
Michael Goulet 2024-11-09 18:21:03 +00:00
parent de27914e8e
commit 8e068b989b
4 changed files with 50 additions and 17 deletions

View file

@ -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);