Skip to content

Robustify and genericize return-type-notation resolution in resolve_bound_vars#132047

Merged
bors merged 3 commits intorust-lang:masterfrom
compiler-errors:rbv-rtn-cleanup
Dec 1, 2024
Merged

Robustify and genericize return-type-notation resolution in resolve_bound_vars#132047
bors merged 3 commits intorust-lang:masterfrom
compiler-errors:rbv-rtn-cleanup

Conversation

@compiler-errors
Copy link
Contributor

@compiler-errors compiler-errors commented Oct 23, 2024

#129629 implemented return-type-notation (RTN) in its path form, like where T::method(..): Bound. As part of lowering, we must record the late-bound vars for the where clause introduced by the method (namely, its early- and late-bound lifetime arguments, since where T::method(..) turns into a higher-ranked where clause over all of the lifetimes according to RFC 3654).

However, this logic was only looking at the where clauses of the parent item that the T::method(..) bound was written on, and not any parent items. This PR generalizes that logic to look at the parent item (i.e. the outer impl or trait) instead and fixes a (debug only) assertion as an effect.

This logic is also more general and likely easier to adapt to more interesting (though likely very far off) cases like non-lifetime binder for<T: Trait> T::method(..): Send bounds.

Tracking:

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-return_type_notation `#[feature(return_type_notation)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE when using RTN in the where clause of a trait

9 participants