]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs
Imported Upstream version 1.0.0~beta.3
[rustc.git] / src / test / compile-fail / unboxed-closure-sugar-lifetime-elision.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 the unboxed closure sugar can be used with an arbitrary
12// struct type and that it is equivalent to the same syntax using
13// angle brackets. This test covers only simple types and in
14// particular doesn't test bound regions.
15
16#![feature(unboxed_closures)]
17#![allow(dead_code)]
18
85aaf69f
SL
19use std::marker;
20
21trait Foo<T> {
22 type Output;
23 fn dummy(&self, t: T);
1a4d82fc
JJ
24}
25
9346a6ac 26trait Eq<X: ?Sized> { }
1a4d82fc
JJ
27impl<X: ?Sized> Eq<X> for X { }
28fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
29
30fn main() {
85aaf69f 31 eq::< for<'a> Foo<(&'a isize,), Output=&'a isize>,
1a4d82fc 32 Foo(&isize) -> &isize >();
85aaf69f 33 eq::< for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>,
1a4d82fc
JJ
34 Foo(&isize) -> (&isize, &isize) >();
35
36 let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier
37}