mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
21 lines
710 B
Rust
21 lines
710 B
Rust
// 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(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
|
//~^ ERROR missing lifetime specifier
|
|
|
|
// 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(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
|
|
//~^ ERROR missing lifetime specifier
|
|
//~| ERROR lifetime may not live long enough
|
|
|
|
fn main() {}
|