From f6cc95aa44b70a6a28fc66971d552ad8579d3bb7 Mon Sep 17 00:00:00 2001 From: Paul Fanelli Date: Fri, 5 Aug 2016 21:20:13 +0000 Subject: [PATCH] Update E0057 error message to new format --- src/librustc_typeck/check/mod.rs | 8 +++----- src/test/compile-fail/issue-18819.rs | 5 ++--- src/test/compile-fail/issue-3044.rs | 3 ++- src/test/compile-fail/issue-4935.rs | 5 ++--- src/test/compile-fail/not-enough-arguments.rs | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 16300d869abf5..173e5125d2056 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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::>(); if input_types.len() > 0 { err.note(&format!("the following parameter type{} expected: {}", diff --git a/src/test/compile-fail/issue-18819.rs b/src/test/compile-fail/issue-18819.rs index cf650460c3de1..b6bdd4c2e65dd 100644 --- a/src/test/compile-fail/issue-18819.rs +++ b/src/test/compile-fail/issue-18819.rs @@ -23,8 +23,7 @@ fn print_x(_: &Foo, 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, &str + print_x(X); //~error this function takes 2 parameters but 1 parameter was supplied + //~^ NOTE the following parameter types were expected: &Foo, &str //~| NOTE expected 2 parameters } diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs index d19e3b2c7b0a8..1fc2aca1409fb 100644 --- a/src/test/compile-fail/issue-3044.rs +++ b/src/test/compile-fail/issue-3044.rs @@ -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. } diff --git a/src/test/compile-fail/issue-4935.rs b/src/test/compile-fail/issue-4935.rs index 58a84f3490b3c..9ca4de7878ce5 100644 --- a/src/test/compile-fail/issue-4935.rs +++ b/src/test/compile-fail/issue-4935.rs @@ -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 diff --git a/src/test/compile-fail/not-enough-arguments.rs b/src/test/compile-fail/not-enough-arguments.rs index f2f61fcaeec16..8dcde2cf48ce2 100644 --- a/src/test/compile-fail/not-enough-arguments.rs +++ b/src/test/compile-fail/not-enough-arguments.rs @@ -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 }