summaryrefslogtreecommitdiffstats
path: root/tests/ui/higher-ranked/trait-bounds/issue-90177.rs
blob: b151a9d3ab6599d709582fe830669db42e4dbfae (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
27
28
29
30
31
32
// check-pass

trait Base<'f> {
    type Assoc;

    fn do_something(&self);
}

trait ForAnyLifetime: for<'f> Base<'f> {}

impl<T> ForAnyLifetime for T where T: for<'f> Base<'f> {}

trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {}

fn foo(a: &dyn CanBeDynamic) {
    a.do_something();
}

struct S;

impl<'a> Base<'a> for S {
    type Assoc = ();

    fn do_something(&self) {}
}

impl CanBeDynamic for S {}

fn main() {
    let s = S;
    foo(&s);
}