]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/hrtb-parse.rs
New upstream version 1.12.0+dfsg1
[rustc.git] / src / test / run-pass / hrtb-parse.rs
CommitLineData
1a4d82fc
JJ
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
c34b1796
AL
14// pretty-expanded FIXME #23616
15
1a4d82fc
JJ
16#![allow(unused_variables)]
17#![allow(dead_code)]
18
19trait Get<A,R> {
20 fn get(&self, arg: A) -> R;
21}
22
23// Parse HRTB with explicit `for` in a where-clause:
24
25fn foo00<T>(t: T)
85aaf69f 26 where T : for<'a> Get<&'a i32, &'a i32>
1a4d82fc
JJ
27{
28}
29
85aaf69f 30fn foo01<T: for<'a> Get<&'a i32, &'a i32>>(t: T)
1a4d82fc
JJ
31{
32}
33
34// Parse HRTB with explicit `for` in various sorts of types:
35
85aaf69f
SL
36fn foo10(t: Box<for<'a> Get<i32, i32>>) { }
37fn foo11(t: Box<for<'a> Fn(i32) -> i32>) { }
1a4d82fc 38
85aaf69f
SL
39fn foo20(t: for<'a> fn(i32) -> i32) { }
40fn foo21(t: for<'a> unsafe fn(i32) -> i32) { }
41fn foo22(t: for<'a> extern "C" fn(i32) -> i32) { }
42fn foo23(t: for<'a> unsafe extern "C" fn(i32) -> i32) { }
1a4d82fc
JJ
43
44fn main() {
45}