keep the use<..> bound in the refining_impl_trait suggestion - #162575
Open
Albab-Hasan wants to merge 1 commit into
Open
Albab-Hasan wants to merge 1 commit into
Albab-Hasan wants to merge 1 commit into
Conversation
davidtwco
requested changes
Sep 23, 2026
|
|
||
| // An `async fn` suggestion replaces the desugared `Future` output rather than an opaque, so | ||
| // there is no `use<..>` bound to carry over. | ||
| let mut precise_capturing = None; |
Member
There was a problem hiding this comment.
precise_capturing is an unintuitive name for this variable - perhaps maybe_use_bounds_for_impl
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
the lint suggested a return type built only from the trait bounds, so the precise capturing list was dropped. applying the suggestion then captured every lifetime in scope and failed to compile with "return type captures more lifetimes than trait definition". the suggestion now carries the capture list over, written in terms of the impl generics. a use<..> bound is only added when the trait opaque leaves out one of the method late bound lifetimes, since everything else already has to be listed in the trait. fixes rust-lang#141047
Albab-Hasan
force-pushed
the
refine-suggestion-precise-capturing
branch
from
September 26, 2026 11:34
1ab55f3 to
9cc3014
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Contributor
Author
|
@rustbot ready |
Contributor
Author
|
apologies for the delay and thanks for the approval |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
the suggestion formats the traits RPITIT and
Displaydoesnt printuse<..>soimpl use<Self> + Sendrenders asimpl std::marker::Send. applying it makes the impl capture the elided&selflifetime which doesnt compile. new helper re emits the capture list when the trait dropped a lifetime.one note. no existing baselines were re blessed so the new test is the only in tree coverage of an undercapturing RPITIT.
fixes #141047
r? @davidtwco