existential impl trait overlooks "hidden" lifetimes from projections #51525
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
A-lifetimes
Area: Lifetimes / regions
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In this example (play), we currently get an incorrect compilation error:
yields
This does not seem correct. =) The problem is that
T::Bar
(at HIR lowering time) does not mention'a
. So we wind up mapping this -- because of the way the region desugaring works -- to<T as Foo<'static>>::Bar
. If you manually write<T as Foo<'a>>::Bar
in the original Rust source, the'a
becomes visible and is lowered correctly. In other words, this version compiles:The text was updated successfully, but these errors were encountered: