]> git.proxmox.com Git - rustc.git/blob - src/test/ui/suggestions/impl-trait-missing-lifetime-gated.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / suggestions / impl-trait-missing-lifetime-gated.rs
1 // edition:2021
2 // gate-test-anonymous_lifetime_in_impl_trait
3 // Verify the behaviour of `feature(anonymous_lifetime_in_impl_trait)`.
4
5 fn f(_: impl Iterator<Item = &'_ ()>) {}
6 //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
7
8 fn g(x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
9 //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
10 //~| ERROR missing lifetime specifier
11
12 // Anonymous lifetimes in async fn are already allowed.
13 // This is understood as `fn foo<'_1>(_: impl Iterator<Item = &'_1 ()>) {}`.
14 async fn h(_: impl Iterator<Item = &'_ ()>) {}
15
16 // Anonymous lifetimes in async fn are already allowed.
17 // But that lifetime does not participate in resolution.
18 async fn i(x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
19 //~^ ERROR missing lifetime specifier
20
21 fn main() {}