]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Test interaction between unboxed closure sugar and region |
2 | // parameters (should be exactly as if angle brackets were used | |
3 | // and regions omitted). | |
4 | ||
5 | #![feature(unboxed_closures)] | |
6 | #![allow(dead_code)] | |
7 | ||
8 | use std::marker; | |
9 | ||
85aaf69f SL |
10 | trait Foo<'a,T> { |
11 | type Output; | |
12 | fn dummy(&'a self) -> &'a (T,Self::Output); | |
1a4d82fc JJ |
13 | } |
14 | ||
85aaf69f | 15 | trait Eq<X: ?Sized> { fn is_of_eq_type(&self, x: &X) -> bool { true } } |
1a4d82fc JJ |
16 | impl<X: ?Sized> Eq<X> for X { } |
17 | fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { } | |
18 | ||
19 | fn same_type<A,B:Eq<A>>(a: A, b: B) { } | |
20 | ||
21 | fn test<'a,'b>() { | |
22 | // Parens are equivalent to omitting default in angle. | |
dc9dc135 | 23 | eq::< dyn Foo<(isize,),Output=()>, dyn Foo(isize) >(); |
1a4d82fc JJ |
24 | |
25 | // Here we specify 'static explicitly in angle-bracket version. | |
26 | // Parenthesized winds up getting inferred. | |
dc9dc135 | 27 | eq::< dyn Foo<'static, (isize,),Output=()>, dyn Foo(isize) >(); |
1a4d82fc JJ |
28 | } |
29 | ||
dc9dc135 | 30 | fn test2(x: &dyn Foo<(isize,),Output=()>, y: &dyn Foo(isize)) { |
5869c6ff | 31 | //~^ ERROR this trait takes 1 lifetime argument but 0 lifetime arguments were supplied |
1a4d82fc | 32 | // Here, the omitted lifetimes are expanded to distinct things. |
32a655c1 | 33 | same_type(x, y) |
1a4d82fc JJ |
34 | } |
35 | ||
36 | fn main() { } |