]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/hrtb-parse.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[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 // pretty-expanded FIXME #23616
15
16 #![feature(unboxed_closures)]
17 #![allow(unused_variables)]
18 #![allow(dead_code)]
19
20 trait Get<A,R> {
21     fn get(&self, arg: A) -> R;
22 }
23
24 // Parse HRTB with explicit `for` in a where-clause:
25
26 fn foo00<T>(t: T)
27     where T : for<'a> Get<&'a i32, &'a i32>
28 {
29 }
30
31 fn foo01<T: for<'a> Get<&'a i32, &'a i32>>(t: T)
32 {
33 }
34
35 // Parse HRTB with explicit `for` in various sorts of types:
36
37 fn foo10(t: Box<for<'a> Get<i32, i32>>) { }
38 fn foo11(t: Box<for<'a> Fn(i32) -> i32>) { }
39
40 fn foo20(t: for<'a> fn(i32) -> i32) { }
41 fn foo21(t: for<'a> unsafe fn(i32) -> i32) { }
42 fn foo22(t: for<'a> extern "C" fn(i32) -> i32) { }
43 fn foo23(t: for<'a> unsafe extern "C" fn(i32) -> i32) { }
44
45 fn main() {
46 }