]> git.lizzy.rs Git - rust.git/blob - tests/ui/inference/issue-72690.rs
Rollup merge of #106869 - notriddle:notriddle/item-decl-pre-rust, r=GuillaumeGomez
[rust.git] / tests / ui / inference / issue-72690.rs
1 fn no_err() {
2     |x: String| x;
3     let _ = String::from("x");
4 }
5
6 fn err() {
7     String::from("x".as_ref()); //~ ERROR type annotations needed
8     //~^ ERROR type annotations needed
9 }
10
11 fn arg_pat_closure_err() {
12     |x| String::from("x".as_ref()); //~ ERROR type annotations needed
13     //~| ERROR type annotations needed
14 }
15
16 fn local_pat_closure_err() {
17     let _ = "x".as_ref(); //~ ERROR type annotations needed
18 }
19
20 fn err_first_arg_pat() {
21     String::from("x".as_ref()); //~ ERROR type annotations needed
22     //~^ ERROR type annotations needed
23     |x: String| x;
24 }
25
26 fn err_second_arg_pat() {
27     |x: String| x;
28     String::from("x".as_ref()); //~ ERROR type annotations needed
29     //~^ ERROR type annotations needed
30 }
31
32 fn err_mid_arg_pat() {
33     |x: String| x;
34     |x: String| x;
35     |x: String| x;
36     |x: String| x;
37     String::from("x".as_ref()); //~ ERROR type annotations needed
38     //~^ ERROR type annotations needed
39     |x: String| x;
40     |x: String| x;
41     |x: String| x;
42     |x: String| x;
43 }
44
45 fn err_first_local_pat() {
46     String::from("x".as_ref()); //~ ERROR type annotations needed
47     //~^ ERROR type annotations needed
48     let _ = String::from("x");
49 }
50
51 fn err_second_local_pat() {
52     let _ = String::from("x");
53     String::from("x".as_ref()); //~ ERROR type annotations needed
54     //~^ ERROR type annotations needed
55 }
56
57 fn err_mid_local_pat() {
58     let _ = String::from("x");
59     let _ = String::from("x");
60     let _ = String::from("x");
61     let _ = String::from("x");
62     String::from("x".as_ref()); //~ ERROR type annotations needed
63     //~^ ERROR type annotations needed
64     let _ = String::from("x");
65     let _ = String::from("x");
66     let _ = String::from("x");
67     let _ = String::from("x");
68 }
69
70 fn main() {}