]> git.proxmox.com Git - rustc.git/blame - src/test/ui/hrtb/issue-90177.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / hrtb / issue-90177.rs
CommitLineData
3c0e092e
XL
1// check-pass
2
3trait Base<'f> {
4 type Assoc;
5
6 fn do_something(&self);
7}
8
9trait ForAnyLifetime: for<'f> Base<'f> {}
10
11impl<T> ForAnyLifetime for T where T: for<'f> Base<'f> {}
12
13trait CanBeDynamic: ForAnyLifetime + for<'f> Base<'f, Assoc = ()> {}
14
15fn foo(a: &dyn CanBeDynamic) {
16 a.do_something();
17}
18
19struct S;
20
21impl<'a> Base<'a> for S {
22 type Assoc = ();
23
24 fn do_something(&self) {}
25}
26
27impl CanBeDynamic for S {}
28
29fn main() {
30 let s = S;
31 foo(&s);
32}