]>
Commit | Line | Data |
---|---|---|
a7813a04 XL |
1 | // revisions: sig local structure 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(sig)] | |
12 | fn sig1(_: for<'a> fn() -> &'a i32) { | |
13 | //[sig]~^ ERROR return type references lifetime `'a` | |
a7813a04 XL |
14 | } |
15 | ||
16 | #[cfg(sig)] | |
17 | fn sig2(_: for<'a, 'b> fn(&'b i32) -> &'a i32) { | |
18 | //[sig]~^ ERROR return type references lifetime `'a` | |
a7813a04 XL |
19 | } |
20 | ||
21 | #[cfg(local)] | |
22 | fn local1() { | |
23 | let _: for<'a> fn() -> &'a i32 = loop { }; | |
24 | //[local]~^ ERROR return type references lifetime `'a` | |
a7813a04 XL |
25 | } |
26 | ||
27 | #[cfg(structure)] | |
28 | struct Struct1 { | |
29 | x: for<'a> fn() -> &'a i32 | |
30 | //[structure]~^ ERROR return type references lifetime `'a` | |
a7813a04 XL |
31 | } |
32 | ||
33 | #[cfg(elision)] | |
34 | fn elision(_: fn() -> &i32) { | |
35 | //[elision]~^ ERROR E0106 | |
36 | } | |
37 | ||
38 | struct Parameterized<'a> { x: &'a str } | |
39 | ||
40 | #[cfg(ok)] | |
dc9dc135 | 41 | fn ok1(_: &dyn for<'a> Fn(&Parameterized<'a>) -> &'a i32) { |
a7813a04 XL |
42 | } |
43 | ||
44 | #[cfg(ok)] | |
dc9dc135 | 45 | fn ok2(_: &dyn for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) { |
a7813a04 XL |
46 | } |
47 | ||
48 | #[rustc_error] | |
60c5eb7d | 49 | fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error] |