2022-07-28 15:18:32 -05:00
|
|
|
#![feature(impl_trait_in_fn_trait_return)]
|
2022-06-23 10:00:03 -05:00
|
|
|
use std::fmt::Debug;
|
|
|
|
|
|
|
|
fn a() -> impl Fn(&u8) -> (impl Debug + '_) {
|
2024-03-07 09:44:07 -06:00
|
|
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
2022-06-23 10:00:03 -05:00
|
|
|
|x| x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
|
2024-03-07 09:44:07 -06:00
|
|
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
2022-06-23 10:00:03 -05:00
|
|
|
|x| x
|
|
|
|
}
|
|
|
|
|
2022-06-23 10:12:13 -05:00
|
|
|
fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
|
2024-03-07 09:44:07 -06:00
|
|
|
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
|
2024-08-31 07:31:31 -05:00
|
|
|
//~| WARNING elided lifetime has a name
|
2022-06-23 10:12:13 -05:00
|
|
|
|x| x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn d() -> impl Fn() -> (impl Debug + '_) {
|
|
|
|
//~^ ERROR missing lifetime specifier
|
|
|
|
|| ()
|
|
|
|
}
|
|
|
|
|
2022-06-23 10:00:03 -05:00
|
|
|
fn main() {}
|