1 // This test checks that it is not possible to enable global type
2 // inference by using the `_` type placeholder.
5 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
7 fn test2() -> (_, _) { (5, 5) }
8 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
10 static TEST3: _ = "test";
11 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
13 static TEST4: _ = 145;
14 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
16 static TEST5: (_, _) = (1, 2);
17 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
20 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
22 fn test6_b<T>(_: _, _: T) { }
23 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
25 fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
26 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
28 fn test7(x: _) { let _x: usize = x; }
29 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
31 fn test8(_f: fn() -> _) { }
32 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
37 fn test9(&self) -> _ { () }
38 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
40 fn test10(&self, _x : _) { }
41 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
44 impl Clone for Test9 {
45 fn clone(&self) -> _ { Test9 }
46 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
48 fn clone_from(&mut self, other: _) { *self = Test9; }
49 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
54 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
59 fn fn_test() -> _ { 5 }
60 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
62 fn fn_test2() -> (_, _) { (5, 5) }
63 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
65 static FN_TEST3: _ = "test";
66 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
68 static FN_TEST4: _ = 145;
69 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
71 static FN_TEST5: (_, _) = (1, 2);
72 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
75 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
77 fn fn_test7(x: _) { let _x: usize = x; }
78 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
80 fn fn_test8(_f: fn() -> _) { }
81 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
86 fn fn_test9(&self) -> _ { () }
87 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
89 fn fn_test10(&self, _x : _) { }
90 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
93 impl Clone for FnTest9 {
94 fn clone(&self) -> _ { FnTest9 }
95 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
97 fn clone_from(&mut self, other: _) { *self = FnTest9; }
98 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
103 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
107 fn fn_test11(_: _) -> (_, _) { panic!() }
108 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
109 //~| ERROR type annotations needed
111 fn fn_test12(x: i32) -> (_, _) { (x, x) }
112 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
114 fn fn_test13(x: _) -> (i32, _) { (x, x) }
115 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
119 fn method_test1(&self, x: _);
120 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
121 fn method_test2(&self, x: _) -> _;
122 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
123 fn method_test3(&self) -> _;
124 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
125 fn assoc_fn_test1(x: _);
126 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
127 fn assoc_fn_test2(x: _) -> _;
128 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
129 fn assoc_fn_test3() -> _;
130 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures