]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/impl-trait-missing-lifetime.rs
Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup
[rust.git] / tests / ui / suggestions / impl-trait-missing-lifetime.rs
1 // edition:2021
2
3 #![feature(anonymous_lifetime_in_impl_trait)]
4
5 // This is understood as `fn foo<'_1>(_: impl Iterator<Item = &'_1 ()>) {}`.
6 fn f(_: impl Iterator<Item = &'_ ()>) {}
7
8 // But that lifetime does not participate in resolution.
9 fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
10 //~^ ERROR missing lifetime specifier
11
12 // This is understood as `fn foo<'_1>(_: impl Iterator<Item = &'_1 ()>) {}`.
13 async fn h(_: impl Iterator<Item = &'_ ()>) {}
14
15 // But that lifetime does not participate in resolution.
16 async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
17 //~^ ERROR missing lifetime specifier
18 //~| ERROR lifetime may not live long enough
19
20 fn main() {}