]> git.lizzy.rs Git - rust.git/blob - src/test/parse-fail/regions-fn-bound.rs
Auto merge of #22541 - Manishearth:rollup, r=Gankro
[rust.git] / src / test / parse-fail / regions-fn-bound.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 // ignore-test
12 // ignored because the first error does not show up.
13
14 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
15 // file at the top-level directory of this distribution and at
16 // http://rust-lang.org/COPYRIGHT.
17 //
18 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
19 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
20 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
21 // option. This file may not be copied, modified, or distributed
22 // except according to those terms.
23
24 fn of<T>() -> |T| { panic!(); }
25 fn subtype<T>(x: |T|) { panic!(); }
26
27 fn test_fn<'x, 'y, 'z, T>(_x: &'x T, _y: &'y T, _z: &'z T) {
28     // Here, x, y, and z are free.  Other letters
29     // are bound.  Note that the arrangement
30     // subtype::<T1>(of::<T2>()) will typecheck
31     // iff T1 <: T2.
32
33     // should be the default:
34     subtype::< ||:'static>(of::<||>());
35     subtype::<||>(of::< ||:'static>());
36
37     //
38     subtype::< <'x> ||>(of::<||>());    //~ ERROR mismatched types
39     subtype::< <'x> ||>(of::< <'y> ||>());  //~ ERROR mismatched types
40
41     subtype::< <'x> ||>(of::< ||:'static>()); //~ ERROR mismatched types
42     subtype::< ||:'static>(of::< <'x> ||>());
43
44 }
45
46 fn main() {}