]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hrtb/issue-90177.rs
Merge commit '370c397ec9169809e5ad270079712e0043514240' into sync_cg_clif-2022-03-20
[rust.git] / src / test / ui / hrtb / issue-90177.rs
1 // check-pass
2
3 trait Base<'f> {
4     type Assoc;
5
6     fn do_something(&self);
7 }
8
9 trait ForAnyLifetime: for<'f> Base<'f> {}
10
11 impl<T> ForAnyLifetime for T where T: for<'f> Base<'f> {}
12
13 trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {}
14
15 fn foo(a: &dyn CanBeDynamic) {
16     a.do_something();
17 }
18
19 struct S;
20
21 impl<'a> Base<'a> for S {
22     type Assoc = ();
23
24     fn do_something(&self) {}
25 }
26
27 impl CanBeDynamic for S {}
28
29 fn main() {
30     let s = S;
31     foo(&s);
32 }