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.
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.
11 // Test interaction between unboxed closure sugar and region
12 // parameters (should be exactly as if angle brackets were used
13 // and regions omitted).
15 #![feature(unboxed_closures)]
21 fn dummy(&'a self) -> &'a (T,U);
24 trait Eq<X: ?Sized> { }
25 impl<X: ?Sized> Eq<X> for X { }
26 fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
28 fn same_type<A,B:Eq<A>>(a: A, b: B) { }
31 // Parens are equivalent to omitting default in angle.
32 eq::< Foo<(isize,),()>, Foo(isize) >();
34 // Here we specify 'static explicitly in angle-bracket version.
35 // Parenthesized winds up getting inferred.
36 eq::< Foo<'static, (isize,),()>, Foo(isize) >();
39 fn test2(x: &Foo<(isize,),()>, y: &Foo(isize)) {
40 // Here, the omitted lifetimes are expanded to distinct things.
41 same_type(x, y) //~ ERROR cannot infer