rustc thinks a lifetime bound is necessary when passing an associated type into a nested call #101601
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-lifetimes
Area: Lifetimes / regions
A-trait-system
Area: Trait system
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
No idea how to more effectively describe this problem in the title. Open to suggestions.
The following code fails to compile on stable (1.63.0) and nightly (playground):
Removing the call to
Self::bar
makes the code compile just fine. It only fails when you try to callbar
from insidefoo
.This is really baffling to me. How is
'a
even involved here?Hint 1: It compiles if
Type
instead owns theT
(playground):Hint 2: It compiles if
foo
andbar
are methods instead of associated functions (playground).Hint 3: It compiles if you do
Type::<'_, T>::bar
instead ofSelf::bar
(playground).I suppose it's possible that this isn't a bug, but if that's the case, then it's a corner of the language I have never hit before, and the diagnostics need a lot of work.
@rustbot label +A-associated-items +A-traits +A-lifetimes
The text was updated successfully, but these errors were encountered: