]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/hrtb-parse.rs
cleanup: s/impl Copy/#[derive(Copy)]/g
[rust.git] / src / test / run-pass / hrtb-parse.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 that we can parse all the various places that a `for` keyword
12 // can appear representing universal quantification.
13
14 #![feature(unboxed_closures)]
15 #![allow(unused_variables)]
16 #![allow(dead_code)]
17
18 trait Get<A,R> {
19     fn get(&self, arg: A) -> R;
20 }
21
22 // Parse HRTB with explicit `for` in a where-clause:
23
24 fn foo00<T>(t: T)
25     where T : for<'a> Get<&'a int, &'a int>
26 {
27 }
28
29 fn foo01<T: for<'a> Get<&'a int, &'a int>>(t: T)
30 {
31 }
32
33 // Parse HRTB with explicit `for` in various sorts of types:
34
35 fn foo10(t: Box<for<'a> Get<int, int>>) { }
36 fn foo11(t: Box<for<'a> Get(int) -> int>) { }
37
38 fn foo20(t: for<'a> fn(int) -> int) { }
39 fn foo21(t: for<'a> unsafe fn(int) -> int) { }
40 fn foo22(t: for<'a> extern "C" fn(int) -> int) { }
41 fn foo23(t: for<'a> unsafe extern "C" fn(int) -> int) { }
42
43 fn main() {
44 }