diff options
Diffstat (limited to 'tests/ui/impl-trait/does-not-live-long-enough.rs')
-rw-r--r-- | tests/ui/impl-trait/does-not-live-long-enough.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/does-not-live-long-enough.rs b/tests/ui/impl-trait/does-not-live-long-enough.rs new file mode 100644 index 000000000..d2a345231 --- /dev/null +++ b/tests/ui/impl-trait/does-not-live-long-enough.rs @@ -0,0 +1,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 E0373 + } +} + +fn main() {} |