trait Foo {
type Assoc<'a>;
}
#[allow(dead_code)]
struct Bar<X, F>
where
X: Foo,
F: for<'a> Fn(X::Assoc<'a>) -> &'a i32
{
x: X,
f: F
}
Current output
error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
--> src/lib.rs:23:42
|
23 | F: for<'a> Fn(X::Content<'a>) -> &'a i32
| ^^^^^^^
For more information about this error, try `rustc --explain E0582`.
Desired output
No response
Rationale and extra context
Problem
This error message could be more helpful.
While 'a appears in the parameter for the associated type, there is no guarantee that an impl for the associated type actually uses the parameter, therefore 'a is not guaranteed to be used in the input for any impl Foo
Suggestion
Either add extra explanation to the error when with regards to associated type usage (e.g. the above problem annotating the X::Assoc<'a> (requires time to implement
Update the rustc --explain E0582 to include this example.
Code
Current output
Desired output
No response
Rationale and extra context
Problem
This error message could be more helpful.
'a
appears in the parameter for the associated type, there is no guarantee that animpl
for the associated type actually uses the parameter, therefore'a
is not guaranteed to be used in the input for anyimpl Foo
Suggestion
X::Assoc<'a>
(requires time to implementrustc --explain E0582
to include this example.Other cases
No response
Rust Version
Anything else?
No response