]> git.lizzy.rs Git - rust.git/blob - tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.rs
Auto merge of #106812 - oli-obk:output_filenames, r=petrochenkov
[rust.git] / tests / ui / higher-rank-trait-bounds / hrtb-higher-ranker-supertraits-transitive.rs
1 // Test HRTB supertraits with several levels of expansion required.
2
3 trait Foo<'tcx>
4 {
5     fn foo(&'tcx self) -> &'tcx isize;
6 }
7
8 trait Bar<'ccx>
9     : for<'tcx> Foo<'tcx>
10 {
11     fn bar(&'ccx self) -> &'ccx isize;
12 }
13
14 trait Baz
15     : for<'ccx> Bar<'ccx>
16 {
17     fn dummy(&self);
18 }
19
20 trait Qux
21     : Bar<'static>
22 {
23     fn dummy(&self);
24 }
25
26 fn want_foo_for_any_tcx<F>(f: &F)
27     where F : for<'tcx> Foo<'tcx>
28 {
29 }
30
31 fn want_bar_for_any_ccx<B>(b: &B)
32     where B : for<'ccx> Bar<'ccx>
33 {
34 }
35
36 fn want_baz<B>(b: &B)
37     where B : Baz
38 {
39     want_foo_for_any_tcx(b);
40     want_bar_for_any_ccx(b);
41 }
42
43 fn want_qux<B>(b: &B)
44     where B : Qux
45 {
46     want_foo_for_any_tcx(b);
47     want_bar_for_any_ccx(b); //~ ERROR
48 }
49
50 fn main() {}