Files
rust/src/test/ui/suggestions/impl-trait-missing-lifetime.rs

20 lines
657 B
Rust
Raw Normal View History

2022-06-22 22:19:02 +02:00
// edition:2021
#![feature(anonymous_lifetime_in_impl_trait)]
// This is understood as `fn foo<'_1>(_: impl Iterator<Item = &'_1 ()>) {}`.
fn f(_: impl Iterator<Item = &'_ ()>) {}
// But that lifetime does not participate in resolution.
fn g(x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
//~^ ERROR missing lifetime specifier
2022-06-22 22:19:02 +02: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.
async fn i(x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
//~^ ERROR missing lifetime specifier
fn main() {}