]> git.proxmox.com Git - rustc.git/blob - src/test/ui/associated-types/bound-lifetime-in-binding-only.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / associated-types / bound-lifetime-in-binding-only.rs
1 // revisions: angle paren ok elision
2
3 #![allow(dead_code)]
4 #![feature(rustc_attrs)]
5 #![feature(unboxed_closures)]
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`
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`
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`
24 }
25
26 #[cfg(angle)]
27 fn angle3(_: &dyn for<'a> Foo<Item=&'a i32>) {
28 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
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`
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`
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`
44 }
45
46 #[cfg(paren)]
47 fn paren3(_: &dyn for<'a> Fn() -> &'a i32) {
48 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
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]
71 fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]