]> git.proxmox.com Git - rustc.git/blame - src/test/ui/argument-suggestions/invalid_arguments.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / argument-suggestions / invalid_arguments.rs
CommitLineData
04454e1e
FG
1// More nuanced test cases for invalid arguments #65853
2
3struct X {}
4
5fn one_arg(_a: i32) {}
6fn two_arg_same(_a: i32, _b: i32) {}
7fn two_arg_diff(_a: i32, _b: f32) {}
8fn three_arg_diff(_a: i32, _b: f32, _c: &str) {}
9fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {}
10
11fn main() {
12 // Providing an incorrect argument for a single parameter function
13 one_arg(1.0); //~ ERROR mismatched types
14
15 // Providing one or two invalid arguments to a two parameter function
16 two_arg_same(1, ""); //~ ERROR mismatched types
17 two_arg_same("", 1); //~ ERROR mismatched types
923072b8 18 two_arg_same("", ""); //~ ERROR arguments to this function are incorrect
04454e1e
FG
19 two_arg_diff(1, ""); //~ ERROR mismatched types
20 two_arg_diff("", 1.0); //~ ERROR mismatched types
923072b8
FG
21 two_arg_diff("", ""); //~ ERROR arguments to this function are incorrect
22
04454e1e
FG
23 // Providing invalid arguments to a three parameter function
24 three_arg_diff(X{}, 1.0, ""); //~ ERROR mismatched types
25 three_arg_diff(1, X {}, ""); //~ ERROR mismatched types
26 three_arg_diff(1, 1.0, X {}); //~ ERROR mismatched types
27
923072b8
FG
28 three_arg_diff(X {}, X {}, ""); //~ ERROR arguments to this function are incorrect
29 three_arg_diff(X {}, 1.0, X {}); //~ ERROR arguments to this function are incorrect
30 three_arg_diff(1, X {}, X {}); //~ ERROR arguments to this function are incorrect
04454e1e 31
923072b8 32 three_arg_diff(X {}, X {}, X {}); //~ ERROR arguments to this function are incorrect
04454e1e
FG
33
34 three_arg_repeat(X {}, 1, ""); //~ ERROR mismatched types
35 three_arg_repeat(1, X {}, ""); //~ ERROR mismatched types
36 three_arg_repeat(1, 1, X {}); //~ ERROR mismatched types
37
923072b8
FG
38 three_arg_repeat(X {}, X {}, ""); //~ ERROR arguments to this function are incorrect
39 three_arg_repeat(X {}, 1, X {}); //~ ERROR arguments to this function are incorrect
40 three_arg_repeat(1, X {}, X{}); //~ ERROR arguments to this function are incorrect
04454e1e 41
923072b8 42 three_arg_repeat(X {}, X {}, X {}); //~ ERROR arguments to this function are incorrect
04454e1e 43}