2022-06-22 15:19:02 -05:00
|
|
|
// edition:2021
|
|
|
|
|
|
|
|
#![feature(anonymous_lifetime_in_impl_trait)]
|
|
|
|
|
2022-06-19 15:57:05 -05: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 11:33:09 -05:00
|
|
|
fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
2022-06-19 15:57:05 -05:00
|
|
|
//~^ ERROR missing lifetime specifier
|
|
|
|
|
2022-06-22 15:19:02 -05: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 11:33:09 -05:00
|
|
|
async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
2022-06-22 15:19:02 -05:00
|
|
|
//~^ ERROR missing lifetime specifier
|
2022-06-05 11:33:09 -05:00
|
|
|
//~| ERROR lifetime may not live long enough
|
2022-06-22 15:19:02 -05:00
|
|
|
|
2020-01-30 13:53:47 -06:00
|
|
|
fn main() {}
|