about summary refs log tree commit diff
path: root/tests/ui/impl-trait/issues/issue-54895.rs
blob: bc1841209e170775c9f063df1dfa8d274007a9dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//@revisions: edition2015 edition2024
//@[edition2015] edition:2015
//@[edition2024] edition:2024
trait Trait<'a> {
    type Out;
    fn call(&'a self) -> Self::Out;
}

struct X(());

impl<'a> Trait<'a> for X {
    type Out = ();
    fn call(&'a self) -> Self::Out {
        ()
    }
}

fn f() -> impl for<'a> Trait<'a, Out = impl Sized + 'a> {
    //~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
    //[edition2024]~^^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
    X(())
}

fn main() {
    let _ = f();
}