]> git.lizzy.rs Git - rust.git/commitdiff
On mismatched argument count point at arguments
authorEsteban Küber <esteban@kuber.com.ar>
Thu, 6 Feb 2020 05:08:07 +0000 (21:08 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Tue, 11 Feb 2020 20:42:00 +0000 (12:42 -0800)
35 files changed:
src/librustc_typeck/check/mod.rs
src/test/ui/arg-count-mismatch.rs
src/test/ui/arg-count-mismatch.stderr
src/test/ui/c-variadic/variadic-ffi-1.rs
src/test/ui/c-variadic/variadic-ffi-1.stderr
src/test/ui/error-codes/E0057.stderr
src/test/ui/error-codes/E0060.rs
src/test/ui/error-codes/E0060.stderr
src/test/ui/error-codes/E0061.rs
src/test/ui/error-codes/E0061.stderr
src/test/ui/hrtb/issue-58451.rs
src/test/ui/hrtb/issue-58451.stderr
src/test/ui/issues/issue-16939.stderr
src/test/ui/issues/issue-18819.stderr
src/test/ui/issues/issue-26094.rs
src/test/ui/issues/issue-26094.stderr
src/test/ui/issues/issue-3044.rs
src/test/ui/issues/issue-3044.stderr
src/test/ui/issues/issue-4935.rs
src/test/ui/issues/issue-4935.stderr
src/test/ui/methods/method-call-err-msg.rs
src/test/ui/methods/method-call-err-msg.stderr
src/test/ui/mismatched_types/overloaded-calls-bad.rs
src/test/ui/mismatched_types/overloaded-calls-bad.stderr
src/test/ui/not-enough-arguments.rs
src/test/ui/not-enough-arguments.stderr
src/test/ui/resolve/resolve-primitive-fallback.rs
src/test/ui/resolve/resolve-primitive-fallback.stderr
src/test/ui/span/E0057.stderr
src/test/ui/span/issue-34264.stderr
src/test/ui/span/missing-unit-argument.stderr
src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.rs
src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr
src/test/ui/type/type-ascription-instead-of-initializer.rs
src/test/ui/type/type-ascription-instead-of-initializer.stderr

index 7e5d27d93b3cb2bfcc6bb87d20ef6196ce29eee7..d2bef80ac365edb2be4dec68989033c0cdcac042 100644 (file)
@@ -3761,17 +3761,58 @@ fn check_argument_types(
                                  error_code: &str,
                                  c_variadic: bool,
                                  sugg_unit: bool| {
+            let (span, start_span, args) = match &expr.kind {
+                hir::ExprKind::Call(hir::Expr { span, .. }, args) => (*span, *span, &args[..]),
+                hir::ExprKind::MethodCall(path_segment, span, args) => (
+                    *span,
+                    // `sp` doesn't point at the whole `foo.bar()`, only at `bar`.
+                    path_segment
+                        .args
+                        .and_then(|args| args.args.iter().last())
+                        // Account for `foo.bar::<T>()`.
+                        .map(|arg| {
+                            // Skip the closing `>`.
+                            tcx.sess
+                                .source_map()
+                                .next_point(tcx.sess.source_map().next_point(arg.span()))
+                        })
+                        .unwrap_or(*span),
+                    &args[1..], // Skip the receiver.
+                ),
+                k => span_bug!(sp, "checking argument types on a non-call: `{:?}`", k),
+            };
+            let arg_spans = if args.is_empty() {
+                // foo()
+                // ^^^-- supplied 0 arguments
+                // |
+                // expected 2 arguments
+                vec![tcx.sess.source_map().next_point(start_span).with_hi(sp.hi())]
+            } else {
+                // foo(1, 2, 3)
+                // ^^^ -  -  - supplied 3 arguments
+                // |
+                // expected 2 arguments
+                args.iter().map(|arg| arg.span).collect::<Vec<Span>>()
+            };
+
             let mut err = tcx.sess.struct_span_err_with_code(
-                sp,
+                span,
                 &format!(
                     "this function takes {}{} but {} {} supplied",
                     if c_variadic { "at least " } else { "" },
-                    potentially_plural_count(expected_count, "parameter"),
-                    potentially_plural_count(arg_count, "parameter"),
+                    potentially_plural_count(expected_count, "argument"),
+                    potentially_plural_count(arg_count, "argument"),
                     if arg_count == 1 { "was" } else { "were" }
                 ),
                 DiagnosticId::Error(error_code.to_owned()),
             );
+            let label = format!("supplied {}", potentially_plural_count(arg_count, "argument"));
+            for (i, span) in arg_spans.into_iter().enumerate() {
+                err.span_label(
+                    span,
+                    if arg_count == 0 || i + 1 == arg_count { &label } else { "" },
+                );
+            }
 
             if let Some(def_s) = def_span.map(|sp| tcx.sess.source_map().def_span(sp)) {
                 err.span_label(def_s, "defined here");
@@ -3788,11 +3829,11 @@ fn check_argument_types(
                 );
             } else {
                 err.span_label(
-                    sp,
+                    span,
                     format!(
                         "expected {}{}",
                         if c_variadic { "at least " } else { "" },
-                        potentially_plural_count(expected_count, "parameter")
+                        potentially_plural_count(expected_count, "argument")
                     ),
                 );
             }
@@ -5494,8 +5535,7 @@ fn check_rustc_args_require_const(&self, def_id: DefId, hir_id: hir::HirId, span
 
         self.tcx.sess.span_err(
             span,
-            "this function can only be invoked \
-                                      directly, not through a function pointer",
+            "this function can only be invoked directly, not through a function pointer",
         );
     }
 
index cf7487069c14a9f1557ccb67495da09faa2faa8a..18926f5daf71a7a91f8db9357c9d548421bf64f0 100644 (file)
@@ -1,4 +1,4 @@
-// error-pattern: parameters were supplied
+// error-pattern: arguments were supplied
 
 fn f(x: isize) { }
 
index 44f160413636a2013bae70c1a8fc0437aac70e70..7bc06134a690dd145903152909d5d7ab107e30b2 100644 (file)
@@ -1,11 +1,13 @@
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/arg-count-mismatch.rs:5:28
    |
 LL | fn f(x: isize) { }
    | -------------- defined here
 LL | 
 LL | fn main() { let i: (); i = f(); }
-   |                            ^^^ expected 1 parameter
+   |                            ^-- supplied 0 arguments
+   |                            |
+   |                            expected 1 argument
 
 error: aborting due to previous error
 
index 6a3ff24b6740fccfa9a0fb94281807205e9e3199..e7197a9d16859e0bae5ab3e2d11a1f3c328f68ab 100644 (file)
@@ -13,8 +13,8 @@ extern "C" fn bar(f: isize, x: u8) {}
 
 fn main() {
     unsafe {
-        foo();  //~ ERROR this function takes at least 2 parameters but 0 parameters were supplied
-        foo(1); //~ ERROR this function takes at least 2 parameters but 1 parameter was supplied
+        foo();  //~ ERROR this function takes at least 2 arguments but 0 arguments were supplied
+        foo(1); //~ ERROR this function takes at least 2 arguments but 1 argument was supplied
 
         let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~ ERROR mismatched types
         let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~ ERROR mismatched types
index 05d839a0c5507c18eed36dd68e1d409e5d99f6dd..318b8aabafb4931430ea5b5f8f88e3322b2b10eb 100644 (file)
@@ -4,23 +4,27 @@ error[E0045]: C-variadic function must have C or cdecl calling convention
 LL |     fn printf(_: *const u8, ...);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention
 
-error[E0060]: this function takes at least 2 parameters but 0 parameters were supplied
+error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied
   --> $DIR/variadic-ffi-1.rs:16:9
    |
 LL |     fn foo(f: isize, x: u8, ...);
    |     ----------------------------- defined here
 ...
 LL |         foo();
-   |         ^^^^^ expected at least 2 parameters
+   |         ^^^-- supplied 0 arguments
+   |         |
+   |         expected at least 2 arguments
 
-error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied
+error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
   --> $DIR/variadic-ffi-1.rs:17:9
    |
 LL |     fn foo(f: isize, x: u8, ...);
    |     ----------------------------- defined here
 ...
 LL |         foo(1);
-   |         ^^^^^^ expected at least 2 parameters
+   |         ^^^ - supplied 1 argument
+   |         |
+   |         expected at least 2 arguments
 
 error[E0308]: mismatched types
   --> $DIR/variadic-ffi-1.rs:19:56
index 6b5890cac36c5e0997da12bbd0bfab32325ce121..31579e282896402d067d47b61d507c0921f252ae 100644 (file)
@@ -1,14 +1,18 @@
-error[E0057]: this function takes 1 parameter but 0 parameters were supplied
+error[E0057]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/E0057.rs:3:13
    |
 LL |     let a = f();
-   |             ^^^ expected 1 parameter
+   |             ^-- supplied 0 arguments
+   |             |
+   |             expected 1 argument
 
-error[E0057]: this function takes 1 parameter but 2 parameters were supplied
+error[E0057]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/E0057.rs:5:13
    |
 LL |     let c = f(2, 3);
-   |             ^^^^^^^ expected 1 parameter
+   |             ^ -  - supplied 2 arguments
+   |             |
+   |             expected 1 argument
 
 error: aborting due to 2 previous errors
 
index 2bb490fb3eabf93fb6dc9d233b44eaf8c0349ed5..941eb2a210bf37b0ab7c77d38f8c7c9d158d83b5 100644 (file)
@@ -5,5 +5,5 @@
 fn main() {
     unsafe { printf(); }
     //~^ ERROR E0060
-    //~| expected at least 1 parameter
+    //~| expected at least 1 argument
 }
index 8a2e7d1a72cd7eb5eb3306481954ffb53396d8cd..a600592c6c2e7f7b54247710af5449524c9fa8f4 100644 (file)
@@ -1,11 +1,13 @@
-error[E0060]: this function takes at least 1 parameter but 0 parameters were supplied
+error[E0060]: this function takes at least 1 argument but 0 arguments were supplied
   --> $DIR/E0060.rs:6:14
    |
 LL |     fn printf(_: *const u8, ...) -> u32;
    |     ------------------------------------ defined here
 ...
 LL |     unsafe { printf(); }
-   |              ^^^^^^^^ expected at least 1 parameter
+   |              ^^^^^^-- supplied 0 arguments
+   |              |
+   |              expected at least 1 argument
 
 error: aborting due to previous error
 
index e64ea36ac925503c722e4480ea37c213e3087588..c7b5fe4310e9328f5c7de0cb1bbbd20bc2732fa7 100644 (file)
@@ -5,9 +5,9 @@ fn f2(a: u16) {}
 fn main() {
     f(0);
     //~^ ERROR E0061
-    //~| expected 2 parameters
+    //~| expected 2 arguments
 
     f2();
     //~^ ERROR E0061
-    //~| expected 1 parameter
+    //~| expected 1 argument
 }
index 73103241f7a7d1a0a75d31e1452fde5c0301271a..dfefa0df31332cc8d656a816a50d87e8e2f5a6e1 100644 (file)
@@ -1,20 +1,24 @@
-error[E0061]: this function takes 2 parameters but 1 parameter was supplied
+error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> $DIR/E0061.rs:6:5
    |
 LL | fn f(a: u16, b: &str) {}
    | --------------------- defined here
 ...
 LL |     f(0);
-   |     ^^^^ expected 2 parameters
+   |     ^ - supplied 1 argument
+   |     |
+   |     expected 2 arguments
 
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/E0061.rs:10:5
    |
 LL | fn f2(a: u16) {}
    | ------------- defined here
 ...
 LL |     f2();
-   |     ^^^^ expected 1 parameter
+   |     ^^-- supplied 0 arguments
+   |     |
+   |     expected 1 argument
 
 error: aborting due to 2 previous errors
 
index 229e50576787970f13cbc023969597e10bc2cfbd..f36d549e476b8baa6b04d25125475c8dd3284965 100644 (file)
@@ -9,5 +9,5 @@ fn f<I>(i: I)
 {}
 
 fn main() {
-    f(&[f()]); //~ ERROR this function takes 1 parameter
+    f(&[f()]); //~ ERROR this function takes 1 argument
 }
index 4648c0182b98e6ebd7ecc97ca2858f2aec5a2bad..c0915808bf523992aadf7ce13cc774862c1f92aa 100644 (file)
@@ -1,4 +1,4 @@
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/issue-58451.rs:12:9
    |
 LL | / fn f<I>(i: I)
@@ -9,7 +9,9 @@ LL | | {}
    | |__- defined here
 ...
 LL |       f(&[f()]);
-   |           ^^^ expected 1 parameter
+   |           ^-- supplied 0 arguments
+   |           |
+   |           expected 1 argument
 
 error: aborting due to previous error
 
index 5df2119c14120bac83b07a7eb451320231c577f4..103f56fa04dd332fc1dc05322b1a4ee549adea23 100644 (file)
@@ -1,8 +1,10 @@
-error[E0057]: this function takes 0 parameters but 1 parameter was supplied
+error[E0057]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/issue-16939.rs:5:9
    |
 LL |     |t| f(t);
-   |         ^^^^ expected 0 parameters
+   |         ^ - supplied 1 argument
+   |         |
+   |         expected 0 arguments
 
 error: aborting due to previous error
 
index 41e8470ecd04f260ec598a7d36eb9342724c6a1b..a952c9b46c9d8ec6a75c82986efd7f8a212c0145 100644 (file)
@@ -1,11 +1,13 @@
-error[E0061]: this function takes 2 parameters but 1 parameter was supplied
+error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> $DIR/issue-18819.rs:16:5
    |
 LL | fn print_x(_: &dyn Foo<Item=bool>, extra: &str) {
    | ----------------------------------------------- defined here
 ...
 LL |     print_x(X);
-   |     ^^^^^^^^^^ expected 2 parameters
+   |     ^^^^^^^ - supplied 1 argument
+   |     |
+   |     expected 2 arguments
 
 error: aborting due to previous error
 
index b9433849853a87a5e0d6686cb902e6d67e930858..78fb0491d82ddd6a548d50f4fc9d66134814a1f8 100644 (file)
@@ -1,13 +1,13 @@
 macro_rules! some_macro {
     ($other: expr) => ({
-        $other(None)
-        //~^ this function takes 0 parameters but 1 parameter was supplied
+        $other(None) //~ NOTE supplied 1 argument
     })
 }
 
-fn some_function() {}
+fn some_function() {} //~ NOTE defined here
 
 fn main() {
     some_macro!(some_function);
-    //~^ in this expansion of some_macro!
+    //~^ ERROR this function takes 0 arguments but 1 argument was supplied
+    //~| NOTE expected 0 arguments
 }
index 0b5b6d5a7504f3172714314470450b3d7b2591b5..2038d88bf46519a128604be53654e63d16a6647d 100644 (file)
@@ -1,16 +1,14 @@
-error[E0061]: this function takes 0 parameters but 1 parameter was supplied
-  --> $DIR/issue-26094.rs:3:9
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/issue-26094.rs:10:17
    |
 LL |         $other(None)
-   |         ^^^^^^^^^^^^ expected 0 parameters
+   |                ---- supplied 1 argument
 ...
 LL | fn some_function() {}
    | ------------------ defined here
 ...
 LL |     some_macro!(some_function);
-   |     --------------------------- in this macro invocation
-   |
-   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+   |                 ^^^^^^^^^^^^^ expected 0 arguments
 
 error: aborting due to previous error
 
index 26db04b69b4a20a9295777d94c82ca795e959037..81d76a90eb0ac42ab2f63936e838b418dfd8ec76 100644 (file)
@@ -2,5 +2,5 @@ fn main() {
     let needlesArr: Vec<char> = vec!['a', 'f'];
     needlesArr.iter().fold(|x, y| {
     });
-    //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied
+    //~^^ ERROR this function takes 2 arguments but 1 argument was supplied
 }
index 35a85b604b29160ad1f4908160e1c14ba5767c3e..d2c010659edd0fb477611d053c94ad776ce7eb98 100644 (file)
@@ -1,8 +1,12 @@
-error[E0061]: this function takes 2 parameters but 1 parameter was supplied
+error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> $DIR/issue-3044.rs:3:23
    |
-LL |     needlesArr.iter().fold(|x, y| {
-   |                       ^^^^ expected 2 parameters
+LL |       needlesArr.iter().fold(|x, y| {
+   |  _______________________^^^^_-
+   | |                       |
+   | |                       expected 2 arguments
+LL | |     });
+   | |_____- supplied 1 argument
 
 error: aborting due to previous error
 
index 3b258c35682c40f523a8936ec7e76bb7c3f04147..b342bbb1b8eab90d69c2b0f3ea61100b7654413e 100644 (file)
@@ -3,4 +3,4 @@
 fn foo(a: usize) {}
 //~^ defined here
 fn main() { foo(5, 6) }
-//~^ ERROR this function takes 1 parameter but 2 parameters were supplied
+//~^ ERROR this function takes 1 argument but 2 arguments were supplied
index a99581fdca18f81398beccd14912971e6fa0036c..0cc686e1cf87f9f18e52b4b5724e0c49d60c61c6 100644 (file)
@@ -1,11 +1,13 @@
-error[E0061]: this function takes 1 parameter but 2 parameters were supplied
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/issue-4935.rs:5:13
    |
 LL | fn foo(a: usize) {}
    | ---------------- defined here
 LL |
 LL | fn main() { foo(5, 6) }
-   |             ^^^^^^^^^ expected 1 parameter
+   |             ^^^ -  - supplied 2 arguments
+   |             |
+   |             expected 1 argument
 
 error: aborting due to previous error
 
index 5ff4b412667c23ad249784d6d757cc6e7907d0b7..9bfacc7babf2e25244b76169968e4574a73c2e83 100644 (file)
@@ -5,16 +5,18 @@ impl Foo {
     fn zero(self) -> Foo { self }
     fn one(self, _: isize) -> Foo { self }
     fn two(self, _: isize, _: isize) -> Foo { self }
+    fn three<T>(self, _: T, _: T, _: T) -> Foo { self }
 }
 
 fn main() {
     let x = Foo;
-    x.zero(0)   //~ ERROR this function takes 0 parameters but 1 parameter was supplied
-     .one()     //~ ERROR this function takes 1 parameter but 0 parameters were supplied
-     .two(0);   //~ ERROR this function takes 2 parameters but 1 parameter was supplied
+    x.zero(0)   //~ ERROR this function takes 0 arguments but 1 argument was supplied
+     .one()     //~ ERROR this function takes 1 argument but 0 arguments were supplied
+     .two(0);   //~ ERROR this function takes 2 arguments but 1 argument was supplied
 
     let y = Foo;
     y.zero()
      .take()    //~ ERROR no method named `take` found
      .one(0);
+    y.three::<usize>(); //~ ERROR this function takes 3 arguments but 0 arguments were supplied
 }
index 7efdd91708a80618bd0b206e233b4a613db76f7c..ab1ef5b9d5aed6980f3c7f27fa94906c08119fc8 100644 (file)
@@ -1,32 +1,38 @@
-error[E0061]: this function takes 0 parameters but 1 parameter was supplied
-  --> $DIR/method-call-err-msg.rs:12:7
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/method-call-err-msg.rs:13:7
    |
 LL |     fn zero(self) -> Foo { self }
    |     -------------------- defined here
 ...
 LL |     x.zero(0)
-   |       ^^^^ expected 0 parameters
+   |       ^^^^ - supplied 1 argument
+   |       |
+   |       expected 0 arguments
 
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
-  --> $DIR/method-call-err-msg.rs:13:7
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
+  --> $DIR/method-call-err-msg.rs:14:7
    |
 LL |     fn one(self, _: isize) -> Foo { self }
    |     ----------------------------- defined here
 ...
 LL |      .one()
-   |       ^^^ expected 1 parameter
+   |       ^^^- supplied 0 arguments
+   |       |
+   |       expected 1 argument
 
-error[E0061]: this function takes 2 parameters but 1 parameter was supplied
-  --> $DIR/method-call-err-msg.rs:14:7
+error[E0061]: this function takes 2 arguments but 1 argument was supplied
+  --> $DIR/method-call-err-msg.rs:15:7
    |
 LL |     fn two(self, _: isize, _: isize) -> Foo { self }
    |     --------------------------------------- defined here
 ...
 LL |      .two(0);
-   |       ^^^ expected 2 parameters
+   |       ^^^ - supplied 1 argument
+   |       |
+   |       expected 2 arguments
 
 error[E0599]: no method named `take` found for struct `Foo` in the current scope
-  --> $DIR/method-call-err-msg.rs:18:7
+  --> $DIR/method-call-err-msg.rs:19:7
    |
 LL | pub struct Foo;
    | --------------- method `take` not found for this
@@ -41,7 +47,18 @@ LL |      .take()
            candidate #1: `std::io::Read`
            candidate #2: `std::iter::Iterator`
 
-error: aborting due to 4 previous errors
+error[E0061]: this function takes 3 arguments but 0 arguments were supplied
+  --> $DIR/method-call-err-msg.rs:21:7
+   |
+LL |     fn three<T>(self, _: T, _: T, _: T) -> Foo { self }
+   |     ------------------------------------------ defined here
+...
+LL |     y.three::<usize>();
+   |       ^^^^^--------- supplied 0 arguments
+   |       |
+   |       expected 3 arguments
+
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0061, E0599.
 For more information about an error, try `rustc --explain E0061`.
index 73e74a97f06b096ef7a6f96f62815d5382b8cc94..902a6ec81d60b9cd87d328c50e1a3c89f6495382 100644 (file)
@@ -27,7 +27,7 @@ fn main() {
     };
     let ans = s("what");    //~ ERROR mismatched types
     let ans = s();
-    //~^ ERROR this function takes 1 parameter but 0 parameters were supplied
+    //~^ ERROR this function takes 1 argument but 0 arguments were supplied
     let ans = s("burma", "shave");
-    //~^ ERROR this function takes 1 parameter but 2 parameters were supplied
+    //~^ ERROR this function takes 1 argument but 2 arguments were supplied
 }
index 5a5dd0562614891bb00fa7264bb3abe0b0c171da..706e25529bfafbd62b2d86e2b72a0fcf30f9a2d2 100644 (file)
@@ -4,17 +4,21 @@ error[E0308]: mismatched types
 LL |     let ans = s("what");
    |                 ^^^^^^ expected `isize`, found `&str`
 
-error[E0057]: this function takes 1 parameter but 0 parameters were supplied
+error[E0057]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/overloaded-calls-bad.rs:29:15
    |
 LL |     let ans = s();
-   |               ^^^ expected 1 parameter
+   |               ^-- supplied 0 arguments
+   |               |
+   |               expected 1 argument
 
-error[E0057]: this function takes 1 parameter but 2 parameters were supplied
+error[E0057]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/overloaded-calls-bad.rs:31:15
    |
 LL |     let ans = s("burma", "shave");
-   |               ^^^^^^^^^^^^^^^^^^^ expected 1 parameter
+   |               ^ -------  ------- supplied 2 arguments
+   |               |
+   |               expected 1 argument
 
 error: aborting due to 3 previous errors
 
index 309283ed7f4fef9da4ff4d7ddb82cb707409dc4d..631bb1dd27415c272305dfb21ebfef79147c909d 100644 (file)
@@ -8,5 +8,5 @@ fn foo(a: isize, b: isize, c: isize, d:isize) {
 
 fn main() {
   foo(1, 2, 3);
-  //~^ ERROR this function takes 4 parameters but 3
+  //~^ ERROR this function takes 4 arguments but 3
 }
index c1ee43ea904845647f826ddec26b70e86bc2fc60..f2b57f71400f1c9fb15679185346b3c84ce60352 100644 (file)
@@ -1,11 +1,13 @@
-error[E0061]: this function takes 4 parameters but 3 parameters were supplied
+error[E0061]: this function takes 4 arguments but 3 arguments were supplied
   --> $DIR/not-enough-arguments.rs:10:3
    |
 LL | fn foo(a: isize, b: isize, c: isize, d:isize) {
    | --------------------------------------------- defined here
 ...
 LL |   foo(1, 2, 3);
-   |   ^^^^^^^^^^^^ expected 4 parameters
+   |   ^^^ -  -  - supplied 3 arguments
+   |   |
+   |   expected 4 arguments
 
 error: aborting due to previous error
 
index e5a3d689d23d83d6f378383685c7c07f4503161a..992bcd7977fcfc12931981cf7d89739229bbf3d4 100644 (file)
@@ -2,7 +2,7 @@ fn main() {
     // Make sure primitive type fallback doesn't work in value namespace
     std::mem::size_of(u16);
     //~^ ERROR expected value, found builtin type `u16`
-    //~| ERROR this function takes 0 parameters but 1 parameter was supplied
+    //~| ERROR this function takes 0 arguments but 1 argument was supplied
 
     // Make sure primitive type fallback doesn't work with global paths
     let _: ::u8;
index 92c2a0329838186820a7a19dd77c84256b49b130..6d61d2f16cafa5861132ca1cdef748ca4c666941 100644 (file)
@@ -10,11 +10,13 @@ error[E0412]: cannot find type `u8` in the crate root
 LL |     let _: ::u8;
    |              ^^ not found in the crate root
 
-error[E0061]: this function takes 0 parameters but 1 parameter was supplied
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
   --> $DIR/resolve-primitive-fallback.rs:3:5
    |
 LL |     std::mem::size_of(u16);
-   |     ^^^^^^^^^^^^^^^^^^^^^^ expected 0 parameters
+   |     ^^^^^^^^^^^^^^^^^ --- supplied 1 argument
+   |     |
+   |     expected 0 arguments
 
 error: aborting due to 3 previous errors
 
index 6b5890cac36c5e0997da12bbd0bfab32325ce121..31579e282896402d067d47b61d507c0921f252ae 100644 (file)
@@ -1,14 +1,18 @@
-error[E0057]: this function takes 1 parameter but 0 parameters were supplied
+error[E0057]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/E0057.rs:3:13
    |
 LL |     let a = f();
-   |             ^^^ expected 1 parameter
+   |             ^-- supplied 0 arguments
+   |             |
+   |             expected 1 argument
 
-error[E0057]: this function takes 1 parameter but 2 parameters were supplied
+error[E0057]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/E0057.rs:5:13
    |
 LL |     let c = f(2, 3);
-   |             ^^^^^^^ expected 1 parameter
+   |             ^ -  - supplied 2 arguments
+   |             |
+   |             expected 1 argument
 
 error: aborting due to 2 previous errors
 
index 80a237ac6aad498d7ce1575307fd790f68d51d42..116f5ddd5b4b20c73f997e34b150bb2186460acc 100644 (file)
@@ -50,14 +50,16 @@ help: if this is a type, explicitly ignore the parameter name
 LL | fn bar(_: x, y: usize) {}
    |        ^^^^
 
-error[E0061]: this function takes 2 parameters but 3 parameters were supplied
+error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/issue-34264.rs:7:5
    |
 LL | fn foo(Option<i32>, String) {}
    | --------------------------- defined here
 ...
 LL |     foo(Some(42), 2, "");
-   |     ^^^^^^^^^^^^^^^^^^^^ expected 2 parameters
+   |     ^^^ --------  -  -- supplied 3 arguments
+   |     |
+   |     expected 2 arguments
 
 error[E0308]: mismatched types
   --> $DIR/issue-34264.rs:8:13
@@ -65,14 +67,16 @@ error[E0308]: mismatched types
 LL |     bar("", "");
    |             ^^ expected `usize`, found `&str`
 
-error[E0061]: this function takes 2 parameters but 3 parameters were supplied
+error[E0061]: this function takes 2 arguments but 3 arguments were supplied
   --> $DIR/issue-34264.rs:10:5
    |
 LL | fn bar(x, y: usize) {}
    | ------------------- defined here
 ...
 LL |     bar(1, 2, 3);
-   |     ^^^^^^^^^^^^ expected 2 parameters
+   |     ^^^ -  -  - supplied 3 arguments
+   |     |
+   |     expected 2 arguments
 
 error: aborting due to 6 previous errors
 
index 90a96e3f174039ff61b035f19100c09ec492c73e..f6344fba3d3684ebca198be5241dc110582f3833 100644 (file)
@@ -1,68 +1,72 @@
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/missing-unit-argument.rs:11:33
    |
 LL |     let _: Result<(), String> = Ok();
-   |                                 ^^^^
+   |                                 ^^-- supplied 0 arguments
    |
 help: expected the unit value `()`; create it with empty parentheses
    |
 LL |     let _: Result<(), String> = Ok(());
    |                                    ^^
 
-error[E0061]: this function takes 2 parameters but 0 parameters were supplied
+error[E0061]: this function takes 2 arguments but 0 arguments were supplied
   --> $DIR/missing-unit-argument.rs:12:5
    |
 LL | fn foo(():(), ():()) {}
    | -------------------- defined here
 ...
 LL |     foo();
-   |     ^^^^^ expected 2 parameters
+   |     ^^^-- supplied 0 arguments
+   |     |
+   |     expected 2 arguments
 
-error[E0061]: this function takes 2 parameters but 1 parameter was supplied
+error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> $DIR/missing-unit-argument.rs:13:5
    |
 LL | fn foo(():(), ():()) {}
    | -------------------- defined here
 ...
 LL |     foo(());
-   |     ^^^^^^^ expected 2 parameters
+   |     ^^^ -- supplied 1 argument
+   |     |
+   |     expected 2 arguments
 
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/missing-unit-argument.rs:14:5
    |
 LL | fn bar(():()) {}
    | ------------- defined here
 ...
 LL |     bar();
-   |     ^^^^^
+   |     ^^^-- supplied 0 arguments
    |
 help: expected the unit value `()`; create it with empty parentheses
    |
 LL |     bar(());
    |         ^^
 
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/missing-unit-argument.rs:15:7
    |
 LL |     fn baz(self, (): ()) { }
    |     -------------------- defined here
 ...
 LL |     S.baz();
-   |       ^^^
+   |       ^^^- supplied 0 arguments
    |
 help: expected the unit value `()`; create it with empty parentheses
    |
 LL |     S.baz(());
    |           ^^
 
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/missing-unit-argument.rs:16:7
    |
 LL |     fn generic<T>(self, _: T) { }
    |     ------------------------- defined here
 ...
 LL |     S.generic::<()>();
-   |       ^^^^^^^
+   |       ^^^^^^^------ supplied 0 arguments
    |
 help: expected the unit value `()`; create it with empty parentheses
    |
index fa3e1a35fc27ac45e96e89c481c9b19b440f0fed..d012687533bbeda82d1816771d1ba9fc125272a0 100644 (file)
@@ -18,6 +18,6 @@ impl E2 {
 }
 
 fn main() {
-    <E>::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied
+    <E>::V(); //~ ERROR this function takes 1 argument but 0 arguments were supplied
     let _: u8 = <E2>::V; //~ ERROR mismatched types
 }
index 95c3a08c04aa80a6955659e48150b26bd06925b3..46e7dd0c517e858ae9d081b6b31050fee1cdf8d7 100644 (file)
@@ -1,11 +1,13 @@
-error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:21:5
    |
 LL |     V(u8)
    |     ----- defined here
 ...
 LL |     <E>::V();
-   |     ^^^^^^^^ expected 1 parameter
+   |     ^^^^^^-- supplied 0 arguments
+   |     |
+   |     expected 1 argument
 
 error[E0308]: mismatched types
   --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17
index aef25250b159fbdc46cf451237aa8c63a1217fd6..9f9b6f06bbc24f9a781d38a9b2ec0b29d32adc4b 100644 (file)
@@ -1,4 +1,4 @@
 fn main() {
     let x: Vec::with_capacity(10, 20);  //~ ERROR expected type, found `10`
-    //~^ ERROR this function takes 1 parameter
+    //~^ ERROR this function takes 1 argument
 }
index 3fe676de59dab2f1c6b60bcead98564a61e6bd35..530f77e5ae9b946cd99c55495357d6c5a71ad47d 100644 (file)
@@ -7,11 +7,13 @@ LL |     let x: Vec::with_capacity(10, 20);
    |         |help: use `=` if you meant to assign
    |         while parsing the type for `x`
 
-error[E0061]: this function takes 1 parameter but 2 parameters were supplied
+error[E0061]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/type-ascription-instead-of-initializer.rs:2:12
    |
 LL |     let x: Vec::with_capacity(10, 20);
-   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter
+   |            ^^^^^^^^^^^^^^^^^^ --  -- supplied 2 arguments
+   |            |
+   |            expected 1 argument
 
 error: aborting due to 2 previous errors