I have a fun one, where the compiler says I have an unused lifetime parameter, except it's clearly used. It feels almost like a compiler error, though I'm probably overlooking something? Who can see the mistake?
error[E0392]: parameter `'a` is never used
--> src/main.rs:7:28
|
7 | pub struct BuiltInFunction<'a, C: Context<'a>> {
| ^^ unused parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
For more information about this error, try `rustc --explain E0392`.
error: could not compile `lifetime-test` (bin "lifetime-test") due to 1 previous error
The actual problem is on line 5, where you have a type alias that doesn't use the lifetime parameter. The warning ought to be there, but rustc expands type aliases in place, so it doesn't check there.
Well, you aren't using it on the right side of Func and only using it as a parameter to that in BuiltInFunction. You can probably use C: for<'a> Context<'a> instead in the parameter lines?