]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/hrtb-higher-ranker-supertraits.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.
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.
11 // Test a trait (`Bar`) with a higher-ranked supertrait.
15 fn foo(&'tcx
self) -> &'tcx
isize;
21 fn bar(&'ccx
self) -> &'ccx
isize;
24 fn want_foo_for_some_tcx
<'x
,F
>(f
: &'x F
)
27 want_foo_for_some_tcx(f
);
28 want_foo_for_any_tcx(f
); //~ ERROR E0277
31 fn want_foo_for_any_tcx
<F
>(f
: &F
)
32 where F
: for<'tcx
> Foo
<'tcx
>
34 want_foo_for_some_tcx(f
);
35 want_foo_for_any_tcx(f
);
38 fn want_bar_for_some_ccx
<'x
,B
>(b
: &B
)
41 want_foo_for_some_tcx(b
);
42 want_foo_for_any_tcx(b
);
44 want_bar_for_some_ccx(b
);
45 want_bar_for_any_ccx(b
); //~ ERROR E0277
48 fn want_bar_for_any_ccx
<B
>(b
: &B
)
49 where B
: for<'ccx
> Bar
<'ccx
>
51 want_foo_for_some_tcx(b
);
52 want_foo_for_any_tcx(b
);
54 want_bar_for_some_ccx(b
);
55 want_bar_for_any_ccx(b
);