]>
Commit | Line | Data |
---|---|---|
a7813a04 XL |
1 | // revisions: angle paren ok elision |
2 | ||
3 | #![allow(dead_code)] | |
4 | #![feature(rustc_attrs)] | |
5 | #![feature(unboxed_closures)] | |
a7813a04 XL |
6 | |
7 | trait Foo { | |
8 | type Item; | |
9 | } | |
10 | ||
11 | #[cfg(angle)] | |
12 | fn angle<T: for<'a> Foo<Item=&'a i32>>() { | |
13 | //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` | |
a7813a04 XL |
14 | } |
15 | ||
16 | #[cfg(angle)] | |
17 | fn angle1<T>() where T: for<'a> Foo<Item=&'a i32> { | |
18 | //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` | |
a7813a04 XL |
19 | } |
20 | ||
21 | #[cfg(angle)] | |
22 | fn angle2<T>() where for<'a> T: Foo<Item=&'a i32> { | |
23 | //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` | |
a7813a04 XL |
24 | } |
25 | ||
26 | #[cfg(angle)] | |
dc9dc135 | 27 | fn angle3(_: &dyn for<'a> Foo<Item=&'a i32>) { |
a7813a04 | 28 | //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` |
a7813a04 XL |
29 | } |
30 | ||
31 | #[cfg(paren)] | |
32 | fn paren<T: for<'a> Fn() -> &'a i32>() { | |
33 | //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a` | |
a7813a04 XL |
34 | } |
35 | ||
36 | #[cfg(paren)] | |
37 | fn paren1<T>() where T: for<'a> Fn() -> &'a i32 { | |
38 | //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a` | |
a7813a04 XL |
39 | } |
40 | ||
41 | #[cfg(paren)] | |
42 | fn paren2<T>() where for<'a> T: Fn() -> &'a i32 { | |
43 | //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a` | |
a7813a04 XL |
44 | } |
45 | ||
46 | #[cfg(paren)] | |
dc9dc135 | 47 | fn paren3(_: &dyn for<'a> Fn() -> &'a i32) { |
a7813a04 | 48 | //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a` |
a7813a04 XL |
49 | } |
50 | ||
51 | #[cfg(elision)] | |
52 | fn elision<T: Fn() -> &i32>() { | |
53 | //[elision]~^ ERROR E0106 | |
54 | } | |
55 | ||
56 | struct Parameterized<'a> { x: &'a str } | |
57 | ||
58 | #[cfg(ok)] | |
59 | fn ok1<T: for<'a> Fn(&Parameterized<'a>) -> &'a i32>() { | |
60 | } | |
61 | ||
62 | #[cfg(ok)] | |
63 | fn ok2<T: for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>>() { | |
64 | } | |
65 | ||
66 | #[cfg(ok)] | |
67 | fn ok3<T>() where for<'a> Parameterized<'a>: Foo<Item=&'a i32> { | |
68 | } | |
69 | ||
70 | #[rustc_error] | |
60c5eb7d | 71 | fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error] |