2022-06-22 20:19:02 +00:00
|
|
|
// edition:2021
|
|
|
|
|
|
|
|
#![feature(anonymous_lifetime_in_impl_trait)]
|
|
|
|
|
2022-06-19 20:57:05 +00:00
|
|
|
// This is understood as `fn foo<'_1>(_: impl Iterator<Item = &'_1 ()>) {}`.
|
|
|
|
fn f(_: impl Iterator<Item = &'_ ()>) {}
|
|
|
|
|
|
|
|
// But that lifetime does not participate in resolution.
|
2022-06-05 16:33:09 +00:00
|
|
|
fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
2022-06-19 20:57:05 +00:00
|
|
|
//~^ ERROR missing lifetime specifier
|
|
|
|
|
2022-06-22 20:19:02 +00:00
|
|
|
// This is understood as `fn foo<'_1>(_: impl Iterator<Item = &'_1 ()>) {}`.
|
|
|
|
async fn h(_: impl Iterator<Item = &'_ ()>) {}
|
|
|
|
|
|
|
|
// But that lifetime does not participate in resolution.
|
2022-06-05 16:33:09 +00:00
|
|
|
async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
2022-06-22 20:19:02 +00:00
|
|
|
//~^ ERROR missing lifetime specifier
|
2022-06-05 16:33:09 +00:00
|
|
|
//~| ERROR lifetime may not live long enough
|
2022-06-22 20:19:02 +00:00
|
|
|
|
2020-01-30 19:53:47 +00:00
|
|
|
fn main() {}
|