Skip to content

Commit 6975b77

Browse files
committed
Add a test for issue 109396
1 parent 516a6d3 commit 6975b77

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
fn f() {}
2+
fn i(_: u32) {}
3+
fn is(_: u32, _: &str) {}
4+
fn s(_: &str) {}
5+
6+
fn main() {
7+
// code expected suggestion
8+
f(0, 1,); // f()
9+
//~^ error: this function takes 0 arguments but 2 arguments were supplied
10+
i(0, 1, 2,); // i(0,)
11+
//~^ error: this function takes 1 argument but 3 arguments were supplied
12+
i(0, 1, 2); // i(0)
13+
//~^ error: this function takes 1 argument but 3 arguments were supplied
14+
is(0, 1, 2, ""); // is(0, "")
15+
//~^ error: this function takes 2 arguments but 4 arguments were supplied
16+
s(0, 1, ""); // s("")
17+
//~^ error: this function takes 1 argument but 3 arguments were supplied
18+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
error[E0061]: this function takes 0 arguments but 2 arguments were supplied
2+
--> $DIR/issue-109425.rs:8:5
3+
|
4+
LL | f(0, 1,); // f()
5+
| ^ - - unexpected argument of type `{integer}`
6+
| |
7+
| unexpected argument of type `{integer}`
8+
|
9+
note: function defined here
10+
--> $DIR/issue-109425.rs:1:4
11+
|
12+
LL | fn f() {}
13+
| ^
14+
help: remove the extra arguments
15+
|
16+
LL - f(0, 1,); // f()
17+
LL + f(,); // f()
18+
|
19+
20+
error[E0061]: this function takes 1 argument but 3 arguments were supplied
21+
--> $DIR/issue-109425.rs:10:5
22+
|
23+
LL | i(0, 1, 2,); // i(0,)
24+
| ^ - - unexpected argument of type `{integer}`
25+
| |
26+
| unexpected argument of type `{integer}`
27+
|
28+
note: function defined here
29+
--> $DIR/issue-109425.rs:2:4
30+
|
31+
LL | fn i(_: u32) {}
32+
| ^ ------
33+
help: remove the extra arguments
34+
|
35+
LL - i(0, 1, 2,); // i(0,)
36+
LL + i(0,); // i(0,)
37+
|
38+
39+
error[E0061]: this function takes 1 argument but 3 arguments were supplied
40+
--> $DIR/issue-109425.rs:12:5
41+
|
42+
LL | i(0, 1, 2); // i(0)
43+
| ^ - - unexpected argument of type `{integer}`
44+
| |
45+
| unexpected argument of type `{integer}`
46+
|
47+
note: function defined here
48+
--> $DIR/issue-109425.rs:2:4
49+
|
50+
LL | fn i(_: u32) {}
51+
| ^ ------
52+
help: remove the extra arguments
53+
|
54+
LL - i(0, 1, 2); // i(0)
55+
LL + i(0); // i(0)
56+
|
57+
58+
error[E0061]: this function takes 2 arguments but 4 arguments were supplied
59+
--> $DIR/issue-109425.rs:14:5
60+
|
61+
LL | is(0, 1, 2, ""); // is(0, "")
62+
| ^^ - - unexpected argument of type `{integer}`
63+
| |
64+
| unexpected argument of type `{integer}`
65+
|
66+
note: function defined here
67+
--> $DIR/issue-109425.rs:3:4
68+
|
69+
LL | fn is(_: u32, _: &str) {}
70+
| ^^ ------ -------
71+
help: remove the extra arguments
72+
|
73+
LL - is(0, 1, 2, ""); // is(0, "")
74+
LL + is(0, ""); // is(0, "")
75+
|
76+
77+
error[E0061]: this function takes 1 argument but 3 arguments were supplied
78+
--> $DIR/issue-109425.rs:16:5
79+
|
80+
LL | s(0, 1, ""); // s("")
81+
| ^ - - unexpected argument of type `{integer}`
82+
| |
83+
| unexpected argument of type `{integer}`
84+
|
85+
note: function defined here
86+
--> $DIR/issue-109425.rs:4:4
87+
|
88+
LL | fn s(_: &str) {}
89+
| ^ -------
90+
help: remove the extra arguments
91+
|
92+
LL - s(0, 1, ""); // s("")
93+
LL + s(, ""); // s("")
94+
|
95+
96+
error: aborting due to 5 previous errors
97+
98+
For more information about this error, try `rustc --explain E0061`.

0 commit comments

Comments
 (0)