rust/tests/ui/suggestions/impl-trait-missing-lifetime.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
710 B
Rust
Raw Normal View History

2022-06-22 20:19:02 +00: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.
2022-06-05 16:33:09 +00:00
fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
//~^ 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
fn main() {}