about summary refs log tree commit diff
path: root/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.rs
blob: 02ed08bd6567b6c0cf55d01ddb739bf024e16d95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Regression test for #97099.
// This was an ICE because `impl Sized` captures the lifetime 'a.

trait Trait<E> {
    type Assoc;
}

struct Foo;

impl<'a> Trait<&'a ()> for Foo {
    type Assoc = ();
}

fn foo() -> impl for<'a> Trait<&'a ()> {
    Foo
}

fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> {
    foo()
    //~^ ERROR hidden type for `impl Sized` captures lifetime that does not appear in bounds
}

fn main() {}