Skip to content
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

Update E0057 error message to new format #35395

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2486,12 +2486,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
arg_count,
if arg_count == 1 {" was"} else {"s were"}),
error_code);

err.span_label(sp, &format!("expected {}{} parameter{}",
if variadic {"at least "} else {""},
expected_count,
if expected_count == 1 {""} else {"s"}));

if variadic {"at least "} else {""},
expected_count,
if expected_count == 1 {""} else {"s"}));
let input_types = fn_inputs.iter().map(|i| format!("{:?}", i)).collect::<Vec<String>>();
if input_types.len() > 0 {
err.note(&format!("the following parameter type{} expected: {}",
Expand Down
5 changes: 2 additions & 3 deletions src/test/compile-fail/issue-18819.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ fn print_x(_: &Foo<Item=bool>, extra: &str) {
}

fn main() {
print_x(X);
//~^ ERROR this function takes 2 parameters but 1 parameter was supplied
//~| NOTE the following parameter types were expected: &Foo<Item=bool>, &str
print_x(X); //~error this function takes 2 parameters but 1 parameter was supplied
//~^ NOTE the following parameter types were expected: &Foo<Item=bool>, &str
//~| NOTE expected 2 parameters
}
3 changes: 2 additions & 1 deletion src/test/compile-fail/issue-3044.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ fn main() {
needlesArr.iter().fold(|x, y| {
});
//~^^ ERROR this function takes 2 parameters but 1 parameter was supplied
//~| NOTE the following parameter types were expected
//~^^^ NOTE the following parameter types were expected
//~| NOTE expected 2 parameters
//
// the first error is, um, non-ideal.
}
5 changes: 2 additions & 3 deletions src/test/compile-fail/issue-4935.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// Regression test for issue #4935

fn foo(a: usize) {}
fn main() { foo(5, 6) }
//~^ ERROR this function takes 1 parameter but 2 parameters were supplied
//~| NOTE the following parameter type was expected
fn main() { foo(5, 6) } //~ ERROR this function takes 1 parameter but 2 parameters were supplied
//~^ NOTE the following parameter type was expected
//~| NOTE expected 1 parameter
2 changes: 1 addition & 1 deletion src/test/compile-fail/not-enough-arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ fn foo(a: isize, b: isize, c: isize, d:isize) {
fn main() {
foo(1, 2, 3);
//~^ ERROR this function takes 4 parameters but 3
//~| NOTE the following parameter types were expected
//~^^ NOTE the following parameter types were expected
//~| NOTE expected 4 parameters
}