-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gccrs: [E0061] Refactored argument mismatch error function
Added Invalid number of arguments (argument mismatch) was passed when calling a function - unexpected number of arguments `x` expected `y` And Refactored error into one function. gcc/rust/ChangeLog: * typecheck/rust-tyty-call.cc (emit_unexpected_argument_error): Refactored invalid number of argument into one function. (TypeCheckCallExpr::visit): called refactored function. (TypeCheckMethodCallExpr::check): likewise gcc/testsuite/ChangeLog: * rust/compile/func2.rs: updated comment to pass new test cases. * rust/compile/tuple_struct2.rs: likewise * rust/compile/unexpected_arguments.rs: New test. Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
- Loading branch information
1 parent
5406b63
commit ebeda72
Showing
4 changed files
with
63 additions
and
34 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
struct Bar(i32, i32, bool); | ||
|
||
fn main() { | ||
let a = Bar(1, 2); // { dg-error "unexpected number of arguments 2 expected 3" } | ||
let a = Bar(1, 2); // { dg-error "this function takes 3 arguments but 2 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,9 @@ | ||
// https://doc.rust-lang.org/error_codes/E0061.html | ||
fn main() { | ||
fn f(u: i32) {} | ||
fn T(u: i32, v: i32, w: i32, x: i32, y: i32, z: i32) {} | ||
|
||
f(); // { dg-error "this function takes 1 argument but 0 arguments were supplied" } | ||
|
||
T(1, 2, 3, 4, 5, 6, 7, 8, 9); // { dg-error "this function takes 6 arguments but 9 arguments were supplied" } | ||
} |