1 // This test ensures that `self` is semantically rejected
2 // in contexts with `FnDecl` but outside of associated `fn`s.
3 // FIXME(Centril): For now closures are an exception.
9 //~^ ERROR `self` parameter is only allowed in associated functions
11 //~^ ERROR `self` parameter is only allowed in associated functions
13 //~^ ERROR `self` parameter is only allowed in associated functions
15 //~^ ERROR `self` parameter is only allowed in associated functions
16 fn f5<'a>(&'a self) {}
17 //~^ ERROR `self` parameter is only allowed in associated functions
18 fn f6<'a>(&'a mut self) {}
19 //~^ ERROR `self` parameter is only allowed in associated functions
21 //~^ ERROR `self` parameter is only allowed in associated functions
22 fn f8(mut self: u8) {}
23 //~^ ERROR `self` parameter is only allowed in associated functions
28 //~^ ERROR `self` parameter is only allowed in associated functions
30 //~^ ERROR `self` parameter is only allowed in associated functions
31 //~| ERROR patterns aren't allowed in
33 //~^ ERROR `self` parameter is only allowed in associated functions
35 //~^ ERROR `self` parameter is only allowed in associated functions
37 //~^ ERROR `self` parameter is only allowed in associated functions
38 fn f6<'a>(&'a mut self);
39 //~^ ERROR `self` parameter is only allowed in associated functions
41 //~^ ERROR `self` parameter is only allowed in associated functions
43 //~^ ERROR `self` parameter is only allowed in associated functions
44 //~| ERROR patterns aren't allowed in
48 //~^ ERROR `self` parameter is only allowed in associated functions
49 type X2 = fn(mut self);
50 //~^ ERROR `self` parameter is only allowed in associated functions
51 //~| ERROR patterns aren't allowed in
53 //~^ ERROR `self` parameter is only allowed in associated functions
54 type X4 = fn(&mut self);
55 //~^ ERROR `self` parameter is only allowed in associated functions
56 type X5 = for<'a> fn(&'a self);
57 //~^ ERROR `self` parameter is only allowed in associated functions
58 type X6 = for<'a> fn(&'a mut self);
59 //~^ ERROR `self` parameter is only allowed in associated functions
60 type X7 = fn(self: u8);
61 //~^ ERROR `self` parameter is only allowed in associated functions
62 type X8 = fn(mut self: u8);
63 //~^ ERROR `self` parameter is only allowed in associated functions
64 //~| ERROR patterns aren't allowed in