fork/rust
git clone https://git.julia.blue/fork/rust
b8cedc00407
1.42.0
1error[E0597]: `prefix` does not live long enough 2 --> $DIR/does-not-live-long-enough.rs:6:51 3 | 4LL | fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> { 5 | -- lifetime `'a` defined here --------------------------- opaque type requires that `prefix` is borrowed for `'a` 6LL | self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref()) 7 | --- ^^^^^^ borrowed value does not live long enough 8 | | 9 | value captured here 10LL | 11LL | } 12 | - `prefix` dropped here while still borrowed 13 | 14help: you can add a bound to the opaque type to make it last less than `'static` and match `'a` 15 | 16LL | fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> + 'a { 17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 18 19error: aborting due to previous error 20 21For more information about this error, try `rustc --explain E0597`.