]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/hrtb-higher-ranker-supertraits-transitive.rs
Update compile fail tests to use isize.
[rust.git] / src / test / compile-fail / hrtb-higher-ranker-supertraits-transitive.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Test HRTB supertraits with several levels of expansion required.
12
13 trait Foo<'tcx>
14 {
15     fn foo(&'tcx self) -> &'tcx isize;
16 }
17
18 trait Bar<'ccx>
19     : for<'tcx> Foo<'tcx>
20 {
21     fn bar(&'ccx self) -> &'ccx isize;
22 }
23
24 trait Baz
25     : for<'ccx> Bar<'ccx>
26 {
27     fn dummy(&self);
28 }
29
30 trait Qux
31     : Bar<'static>
32 {
33     fn dummy(&self);
34 }
35
36 fn want_foo_for_any_tcx<F>(f: &F)
37     where F : for<'tcx> Foo<'tcx>
38 {
39 }
40
41 fn want_bar_for_any_ccx<B>(b: &B)
42     where B : for<'ccx> Bar<'ccx>
43 {
44 }
45
46 fn want_baz<B>(b: &B)
47     where B : Baz
48 {
49     want_foo_for_any_tcx(b);
50     want_bar_for_any_ccx(b);
51 }
52
53 fn want_qux<B>(b: &B)
54     where B : Qux
55 {
56     want_foo_for_any_tcx(b);
57     want_bar_for_any_ccx(b); //~ ERROR not implemented
58 }
59
60 fn main() {}