1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // This test checks that it is not possible to enable global type
12 // inference by using the `_` type placeholder.
15 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
17 fn test2() -> (_, _) { (5, 5) }
18 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
19 //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
21 static TEST3: _ = "test";
22 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
24 static TEST4: _ = 145;
25 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
27 static TEST5: (_, _) = (1, 2);
28 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
29 //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
32 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
34 fn test7(x: _) { let _x: usize = x; }
35 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
37 fn test8(_f: fn() -> _) { }
38 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
43 fn test9(&self) -> _ { () }
44 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
46 fn test10(&self, _x : _) { }
47 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
50 impl Clone for Test9 {
51 fn clone(&self) -> _ { Test9 }
52 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
54 fn clone_from(&mut self, other: _) { *self = Test9; }
55 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
60 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
62 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
63 //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
67 fn fn_test() -> _ { 5 }
68 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
70 fn fn_test2() -> (_, _) { (5, 5) }
71 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
72 //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
74 static FN_TEST3: _ = "test";
75 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
77 static FN_TEST4: _ = 145;
78 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
80 static FN_TEST5: (_, _) = (1, 2);
81 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
82 //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
85 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
87 fn fn_test7(x: _) { let _x: usize = x; }
88 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
90 fn fn_test8(_f: fn() -> _) { }
91 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
96 fn fn_test9(&self) -> _ { () }
97 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
99 fn fn_test10(&self, _x : _) { }
100 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
103 impl Clone for FnTest9 {
104 fn clone(&self) -> _ { FnTest9 }
105 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
107 fn clone_from(&mut self, other: _) { *self = FnTest9; }
108 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
113 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
115 //~^ ERROR the type placeholder `_` is not allowed within types on item signatures
116 //~^^ ERROR the type placeholder `_` is not allowed within types on item signatures