summary refs log tree commit diff
path: root/src/test/ui/impl-trait/does-not-live-long-enough.rs
blob: 6179132b3f6080e0decb74aebfe80b4a49eb702e (plain)
1
2
3
4
5
6
7
8
9
10
11
struct List {
    data: Vec<String>,
}
impl List {
    fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> {
        self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref())
        //~^ ERROR does not live long enough
    }
}

fn main() {}