I am playing around with a generational repository and stumbled upon the following error for this code:
error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements ... = note: expected `&mut (dyn Element + 'static)` found `&mut (dyn Element + 'static)`
If you remove the
iter_layer_elements_mut from the example, it compiles fine.
First of all, why does it need to be a
'static lifetime for the
dyn Element for the return value of
element_mut (line 26) but for the immutable version
'a is just fine.
Also, why does the first example not work and how do I get this to work.