Confusing diagnostic when forgetting to capture lifetime in a APIT #124479
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: lifetime related
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
It is not very clear from the error why
impl B
introduces the lifetime requirement or why we "found" a&_
(this leaks generalizer impl kinda). Ideally we would explain the actual cause of the error (impl B
introduces a new generic parameter outside of the scope offor<'a>
).I don't like having
for<'a> &'a _
in the desired error either, because it implies that it's a type that exists, but I couldn't come up with a better explanation for the fact that'a
is from thefor<'a>
...Maybe we could even suggest
impl for<'a> A<'a, Assoc: B>)
but @BoxyUwU says it's probably hard. We could just lint onimpl Trait<Assoc = impl Other>
as a style thing suggestingAssoc: Other
since it allows more things.Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: