error[E0308]: method not compatible with trait --> $DIR/issue-37884.rs:16:5 | LL | / fn next(&'a mut self) -> Option LL | | //~^ ERROR method not compatible with trait LL | | //~| lifetime mismatch LL | | { LL | | Some(&mut self.0) LL | | } | |_____^ lifetime mismatch | = note: expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` found type `fn(&'a mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` note: the anonymous lifetime #1 defined on the method body at 16:5... --> $DIR/issue-37884.rs:16:5 | LL | / fn next(&'a mut self) -> Option LL | | //~^ ERROR method not compatible with trait LL | | //~| lifetime mismatch LL | | { LL | | Some(&mut self.0) LL | | } | |_____^ note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:1 --> $DIR/issue-37884.rs:13:1 | LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0308`.