Incoherent error when a method and the containing impl require the same trait with different lifetimes #78258
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
A-lifetimes
Area: Lifetimes / regions
A-trait-system
Area: Trait system
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
While trying to make the lifetimes work in a
-> impl Iterator
method, I ran into a weird error. Minimal test case:As far as I can tell, this should be valid code. However, it gives this bizarre error message:
This occurs on both stable and nightly.
More details
The error still occurs if we replace one lifetime with
'static
- eitheror
But it doesn't occur if either bound is removed, or if the same lifetime is used in both bounds, or if the bounds differ by a type parameter rather than a lifetime parameter.
On stable, the error message is even less helpful if the trait has an associated type:
But on nightly, the error is the same either way.
The text was updated successfully, but these errors were encountered: