-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Improve suggestion for "missing function argument" on multiline call #144966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ LL | <$from>::$method(8, /* u8 */) | |
| ++++++++++ | ||
|
||
error[E0061]: this function takes 4 arguments but 3 arguments were supplied | ||
--> $DIR/fn-arg-count-mismatch-diagnostics.rs:50:5 | ||
--> $DIR/fn-arg-count-mismatch-diagnostics.rs:52:5 | ||
| | ||
LL | foo(1, 2, 3); | ||
| ^^^--------- argument #4 of type `isize` is missing | ||
|
@@ -68,7 +68,7 @@ LL | foo(1, 2, 3, /* isize */); | |
| +++++++++++++ | ||
|
||
error[E0061]: this function takes 6 arguments but 3 arguments were supplied | ||
--> $DIR/fn-arg-count-mismatch-diagnostics.rs:52:5 | ||
--> $DIR/fn-arg-count-mismatch-diagnostics.rs:54:5 | ||
| | ||
LL | bar(1, 2, 3); | ||
| ^^^--------- three arguments of type `i32`, `i32`, and `i32` are missing | ||
|
@@ -83,6 +83,28 @@ help: provide the arguments | |
LL | bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); | ||
| +++++++++++++++++++++++++++++++++ | ||
|
||
error: aborting due to 5 previous errors | ||
error[E0061]: this function takes 6 arguments but 5 arguments were supplied | ||
--> $DIR/fn-arg-count-mismatch-diagnostics.rs:58:5 | ||
| | ||
LL | function_with_lots_of_arguments( | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | variable_name, | ||
LL | variable_name, | ||
| ------------- argument #2 of type `char` is missing | ||
| | ||
note: function defined here | ||
--> $DIR/fn-arg-count-mismatch-diagnostics.rs:49:4 | ||
| | ||
LL | fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i32, f: i32) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- | ||
help: provide the argument | ||
| | ||
LL | function_with_lots_of_arguments( | ||
LL | variable_name, | ||
LL ~ /* char */, | ||
LL ~ variable_name, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why this line is labeled as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the suggestion I think is being constructed as You could modify this by appending the line to the previous arg, I think but it would require restructuring your logic. |
||
| | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0061`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case is a bit unfortunate, though I don't know if we'd benefit from tweaking the heuristic to detect "fake" multiline args (i.e. when there's only one line break).