forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#109782 - WaffleLapkin:nocommawhenremovingar…
…guments, r=oli-obk Don't leave a comma at the start of argument list when removing arguments Fixes rust-lang#109425 Quite a dirty hack, but at least it works ig.
- Loading branch information
Showing
5 changed files
with
173 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// run-rustfix | ||
|
||
fn f() {} | ||
fn i(_: u32) {} | ||
fn is(_: u32, _: &str) {} | ||
fn s(_: &str) {} | ||
|
||
fn main() { | ||
// code expected suggestion | ||
f(); // f() | ||
//~^ error: this function takes 0 arguments but 2 arguments were supplied | ||
i(0,); // i(0,) | ||
//~^ error: this function takes 1 argument but 3 arguments were supplied | ||
i(0); // i(0) | ||
//~^ error: this function takes 1 argument but 3 arguments were supplied | ||
is(0, ""); // is(0, "") | ||
//~^ error: this function takes 2 arguments but 4 arguments were supplied | ||
s(""); // s("") | ||
//~^ error: this function takes 1 argument but 3 arguments were supplied | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// run-rustfix | ||
|
||
fn f() {} | ||
fn i(_: u32) {} | ||
fn is(_: u32, _: &str) {} | ||
fn s(_: &str) {} | ||
|
||
fn main() { | ||
// code expected suggestion | ||
f(0, 1,); // f() | ||
//~^ error: this function takes 0 arguments but 2 arguments were supplied | ||
i(0, 1, 2,); // i(0,) | ||
//~^ error: this function takes 1 argument but 3 arguments were supplied | ||
i(0, 1, 2); // i(0) | ||
//~^ error: this function takes 1 argument but 3 arguments were supplied | ||
is(0, 1, 2, ""); // is(0, "") | ||
//~^ error: this function takes 2 arguments but 4 arguments were supplied | ||
s(0, 1, ""); // s("") | ||
//~^ error: this function takes 1 argument but 3 arguments were supplied | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
error[E0061]: this function takes 0 arguments but 2 arguments were supplied | ||
--> $DIR/issue-109425.rs:10:5 | ||
| | ||
LL | f(0, 1,); // f() | ||
| ^ - - unexpected argument of type `{integer}` | ||
| | | ||
| unexpected argument of type `{integer}` | ||
| | ||
note: function defined here | ||
--> $DIR/issue-109425.rs:3:4 | ||
| | ||
LL | fn f() {} | ||
| ^ | ||
help: remove the extra arguments | ||
| | ||
LL - f(0, 1,); // f() | ||
LL + f(); // f() | ||
| | ||
|
||
error[E0061]: this function takes 1 argument but 3 arguments were supplied | ||
--> $DIR/issue-109425.rs:12:5 | ||
| | ||
LL | i(0, 1, 2,); // i(0,) | ||
| ^ - - unexpected argument of type `{integer}` | ||
| | | ||
| unexpected argument of type `{integer}` | ||
| | ||
note: function defined here | ||
--> $DIR/issue-109425.rs:4:4 | ||
| | ||
LL | fn i(_: u32) {} | ||
| ^ ------ | ||
help: remove the extra arguments | ||
| | ||
LL - i(0, 1, 2,); // i(0,) | ||
LL + i(0,); // i(0,) | ||
| | ||
|
||
error[E0061]: this function takes 1 argument but 3 arguments were supplied | ||
--> $DIR/issue-109425.rs:14:5 | ||
| | ||
LL | i(0, 1, 2); // i(0) | ||
| ^ - - unexpected argument of type `{integer}` | ||
| | | ||
| unexpected argument of type `{integer}` | ||
| | ||
note: function defined here | ||
--> $DIR/issue-109425.rs:4:4 | ||
| | ||
LL | fn i(_: u32) {} | ||
| ^ ------ | ||
help: remove the extra arguments | ||
| | ||
LL - i(0, 1, 2); // i(0) | ||
LL + i(0); // i(0) | ||
| | ||
|
||
error[E0061]: this function takes 2 arguments but 4 arguments were supplied | ||
--> $DIR/issue-109425.rs:16:5 | ||
| | ||
LL | is(0, 1, 2, ""); // is(0, "") | ||
| ^^ - - unexpected argument of type `{integer}` | ||
| | | ||
| unexpected argument of type `{integer}` | ||
| | ||
note: function defined here | ||
--> $DIR/issue-109425.rs:5:4 | ||
| | ||
LL | fn is(_: u32, _: &str) {} | ||
| ^^ ------ ------- | ||
help: remove the extra arguments | ||
| | ||
LL - is(0, 1, 2, ""); // is(0, "") | ||
LL + is(0, ""); // is(0, "") | ||
| | ||
|
||
error[E0061]: this function takes 1 argument but 3 arguments were supplied | ||
--> $DIR/issue-109425.rs:18:5 | ||
| | ||
LL | s(0, 1, ""); // s("") | ||
| ^ - - unexpected argument of type `{integer}` | ||
| | | ||
| unexpected argument of type `{integer}` | ||
| | ||
note: function defined here | ||
--> $DIR/issue-109425.rs:6:4 | ||
| | ||
LL | fn s(_: &str) {} | ||
| ^ ------- | ||
help: remove the extra arguments | ||
| | ||
LL - s(0, 1, ""); // s("") | ||
LL + s(""); // s("") | ||
| | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0061`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters