]>
Commit | Line | Data |
---|---|---|
ff7c6d11 XL |
1 | type A = [u8; 4]::AssocTy; |
2 | //~^ ERROR missing angle brackets in associated item path | |
3 | //~| ERROR ambiguous associated type | |
4 | ||
5 | type B = [u8]::AssocTy; | |
6 | //~^ ERROR missing angle brackets in associated item path | |
7 | //~| ERROR ambiguous associated type | |
8 | ||
9 | type C = (u8)::AssocTy; | |
10 | //~^ ERROR missing angle brackets in associated item path | |
11 | //~| ERROR ambiguous associated type | |
12 | ||
13 | type D = (u8, u8)::AssocTy; | |
14 | //~^ ERROR missing angle brackets in associated item path | |
15 | //~| ERROR ambiguous associated type | |
16 | ||
17 | type E = _::AssocTy; | |
18 | //~^ ERROR missing angle brackets in associated item path | |
19 | //~| ERROR the type placeholder `_` is not allowed within types on item signatures | |
20 | ||
21 | type F = &'static (u8)::AssocTy; | |
22 | //~^ ERROR missing angle brackets in associated item path | |
23 | //~| ERROR ambiguous associated type | |
24 | ||
25 | // Qualified paths cannot appear in bounds, so the recovery | |
26 | // should apply to the whole sum and not `(Send)`. | |
dc9dc135 | 27 | type G = dyn 'static + (Send)::AssocTy; |
ff7c6d11 XL |
28 | //~^ ERROR missing angle brackets in associated item path |
29 | //~| ERROR ambiguous associated type | |
30 | ||
31 | // This is actually a legal path with fn-like generic arguments in the middle! | |
32 | // Recovery should not apply in this context. | |
33 | type H = Fn(u8) -> (u8)::Output; | |
34 | //~^ ERROR ambiguous associated type | |
35 | ||
532ac7d7 XL |
36 | macro_rules! ty { |
37 | ($ty: ty) => ($ty::AssocTy); | |
38 | //~^ ERROR missing angle brackets in associated item path | |
39 | //~| ERROR ambiguous associated type | |
40 | () => (u8); | |
41 | } | |
42 | ||
43 | type J = ty!(u8); | |
44 | type I = ty!()::AssocTy; | |
45 | //~^ ERROR missing angle brackets in associated item path | |
46 | //~| ERROR ambiguous associated type | |
47 | ||
72b1a166 FG |
48 | trait K<A, B> {} |
49 | fn foo<X: K<_, _>>(x: X) {} | |
50 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
51 | ||
52 | fn bar<F>(_: F) where F: Fn() -> _ {} | |
53 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
54 | ||
55 | fn baz<F: Fn() -> _>(_: F) {} | |
56 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
57 | ||
58 | struct L<F>(F) where F: Fn() -> _; | |
59 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
60 | struct M<F> where F: Fn() -> _ { | |
61 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
62 | a: F, | |
63 | } | |
64 | enum N<F> where F: Fn() -> _ { | |
65 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
66 | Foo(F), | |
67 | } | |
68 | ||
69 | union O<F> where F: Fn() -> _ { | |
70 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
71 | foo: F, | |
72 | } | |
73 | ||
74 | trait P<F> where F: Fn() -> _ { | |
75 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
76 | } | |
77 | ||
78 | trait Q { | |
79 | fn foo<F>(_: F) where F: Fn() -> _ {} | |
80 | //~^ ERROR the type placeholder `_` is not allowed within types on item signatures | |
81 | } | |
82 | ||
ff7c6d11 | 83 | fn main() {} |