Skip to content

Commit

Permalink
Update E0057 error message to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfanelli committed Aug 25, 2016
1 parent 17a2be8 commit f6cc95a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
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
}

0 comments on commit f6cc95a

Please sign in to comment.