The type-checker assumes that Trait<'a>::AssociatedType may be outlived by 'a, even with "where AssociatedType: 'a" #63253
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Compilation fails on the playground (for stable 1.36.0 and nightly 1.38.0) with this error:
Compilation succeeds if I make any of the following changes:
Add a lifetime constraint to
Ty
at its definition site,type Ty: 'a;
Move the lifetime parameter from the trait to the method,
fn method<'a>(...)
Compilation fails with the same error message if I change
method
into a free function:Even if this is intended behaviour, the error message could be improved.
The text was updated successfully, but these errors were encountered: