Tweak wording of fn call with wrong number of args

This commit is contained in:
Esteban Küber 2023-01-05 03:02:10 +00:00
parent b7cdb635c4
commit 5393c6bbd1
64 changed files with 143 additions and 146 deletions

View file

@ -473,7 +473,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
call_expr: &hir::Expr<'tcx>,
) {
// Next, let's construct the error
let (error_span, full_call_span, ctor_of, is_method) = match &call_expr.kind {
let (error_span, full_call_span, call_name, is_method) = match &call_expr.kind {
hir::ExprKind::Call(
hir::Expr { hir_id, span, kind: hir::ExprKind::Path(qpath), .. },
_,
@ -481,12 +481,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Res::Def(DefKind::Ctor(of, _), _) =
self.typeck_results.borrow().qpath_res(qpath, *hir_id)
{
(call_span, *span, Some(of), false)
let name = match of {
CtorOf::Struct => "struct",
CtorOf::Variant => "enum variant",
};
(call_span, *span, name, false)
} else {
(call_span, *span, None, false)
(call_span, *span, "function", false)
}
}
hir::ExprKind::Call(hir::Expr { span, .. }, _) => (call_span, *span, None, false),
hir::ExprKind::Call(hir::Expr { span, .. }, _) => (call_span, *span, "function", false),
hir::ExprKind::MethodCall(path_segment, _, _, span) => {
let ident_span = path_segment.ident.span;
let ident_span = if let Some(args) = path_segment.args {
@ -494,17 +498,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
ident_span
};
// methods are never ctors
(*span, ident_span, None, true)
(*span, ident_span, "method", true)
}
k => span_bug!(call_span, "checking argument types on a non-call: `{:?}`", k),
};
let args_span = error_span.trim_start(full_call_span).unwrap_or(error_span);
let call_name = match ctor_of {
Some(CtorOf::Struct) => "struct",
Some(CtorOf::Variant) => "enum variant",
None => "function",
};
// Don't print if it has error types or is just plain `_`
fn has_error_or_infer<'tcx>(tys: impl IntoIterator<Item = Ty<'tcx>>) -> bool {
@ -690,8 +688,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
err = tcx.sess.struct_span_err_with_code(
full_call_span,
&format!(
"this {} takes {}{} but {} {} supplied",
call_name,
"{call_name} takes {}{} but {} {} supplied",
if c_variadic { "at least " } else { "" },
potentially_plural_count(
formal_and_expected_inputs.len(),

View file

@ -7,7 +7,7 @@
struct Layout;
#[alloc_error_handler]
fn oom() -> ! { //~ ERROR this function takes 0 arguments but 1 argument was supplied
fn oom() -> ! { //~ ERROR function takes 0 arguments but 1 argument was supplied
loop {}
}

View file

@ -18,11 +18,11 @@ fn permuted(_x: X, _y: Y, _z: Z) {}
fn main() {
invalid(1.0); //~ ERROR mismatched types
extra(""); //~ ERROR this function takes
missing(); //~ ERROR this function takes
extra(""); //~ ERROR function takes
missing(); //~ ERROR function takes
swapped("", 1); //~ ERROR arguments to this function are incorrect
permuted(Y {}, Z {}, X {}); //~ ERROR arguments to this function are incorrect
let closure = |x| x;
closure(); //~ ERROR this function takes
closure(); //~ ERROR function takes
}

View file

@ -4,5 +4,5 @@ fn foo(x: &(dyn Display + Send)) {}
fn main() {
foo();
//~^ ERROR this function takes 1 argument but 0 arguments were supplied
//~^ ERROR function takes 1 argument but 0 arguments were supplied
}

View file

@ -1,11 +1,11 @@
fn foo<T: Fn()>(t: T) {
t(1i32);
//~^ ERROR this function takes 0 arguments but 1 argument was supplied
//~^ ERROR function takes 0 arguments but 1 argument was supplied
}
fn bar(t: impl Fn()) {
t(1i32);
//~^ ERROR this function takes 0 arguments but 1 argument was supplied
//~^ ERROR function takes 0 arguments but 1 argument was supplied
}
fn baz() -> impl Fn() {
@ -14,13 +14,13 @@ fn baz() -> impl Fn() {
fn baz2() {
baz()(1i32)
//~^ ERROR this function takes 0 arguments but 1 argument was supplied
//~^ ERROR function takes 0 arguments but 1 argument was supplied
}
fn qux() {
let x = || {};
x(1i32);
//~^ ERROR this function takes 0 arguments but 1 argument was supplied
//~^ ERROR function takes 0 arguments but 1 argument was supplied
}
fn main() {}

View file

@ -5,5 +5,5 @@ extern "Rust" {
fn main() {
dstfn(1);
//~^ ERROR this function takes 2 arguments but 1 argument was supplied
//~^ ERROR function takes 2 arguments but 1 argument was supplied
}

View file

@ -4,30 +4,30 @@ fn two_arg_same(_a: i32, _b: i32) {}
fn two_arg_diff(_a: i32, _b: &str) {}
fn main() {
empty(""); //~ ERROR this function takes
empty(""); //~ ERROR function takes
one_arg(1, 1); //~ ERROR this function takes
one_arg(1, ""); //~ ERROR this function takes
one_arg(1, "", 1.0); //~ ERROR this function takes
one_arg(1, 1); //~ ERROR function takes
one_arg(1, ""); //~ ERROR function takes
one_arg(1, "", 1.0); //~ ERROR function takes
two_arg_same(1, 1, 1); //~ ERROR this function takes
two_arg_same(1, 1, 1.0); //~ ERROR this function takes
two_arg_same(1, 1, 1); //~ ERROR function takes
two_arg_same(1, 1, 1.0); //~ ERROR function takes
two_arg_diff(1, 1, ""); //~ ERROR this function takes
two_arg_diff(1, "", ""); //~ ERROR this function takes
two_arg_diff(1, 1, "", ""); //~ ERROR this function takes
two_arg_diff(1, "", 1, ""); //~ ERROR this function takes
two_arg_diff(1, 1, ""); //~ ERROR function takes
two_arg_diff(1, "", ""); //~ ERROR function takes
two_arg_diff(1, 1, "", ""); //~ ERROR function takes
two_arg_diff(1, "", 1, ""); //~ ERROR function takes
// Check with weird spacing and newlines
two_arg_same(1, 1, ""); //~ ERROR this function takes
two_arg_diff(1, 1, ""); //~ ERROR this function takes
two_arg_same( //~ ERROR this function takes
two_arg_same(1, 1, ""); //~ ERROR function takes
two_arg_diff(1, 1, ""); //~ ERROR function takes
two_arg_same( //~ ERROR function takes
1,
1,
""
);
two_arg_diff( //~ ERROR this function takes
two_arg_diff( //~ ERROR function takes
1,
1,
""

View file

@ -2,6 +2,6 @@ fn foo(i: impl std::fmt::Display) {}
fn main() {
foo::<()>(());
//~^ ERROR this function takes 0 generic arguments but 1 generic argument was supplied
//~^ ERROR function takes 0 generic arguments but 1 generic argument was supplied
//~| ERROR `()` doesn't implement `std::fmt::Display`
}

View file

@ -31,7 +31,7 @@ fn three_diff(_a: T1, _b: T2, _c: T3) {}
fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {}
fn main() {
three_diff(T2::new(0)); //~ ERROR this function takes
three_diff(T2::new(0)); //~ ERROR function takes
four_shuffle(T3::default(), T4::default(), T1::default(), T2::default()); //~ ERROR 35:5: 35:17: arguments to this function are incorrect [E0308]
four_shuffle(T3::default(), T2::default(), T1::default(), T3::default()); //~ ERROR 36:5: 36:17: arguments to this function are incorrect [E0308]

View file

@ -13,7 +13,7 @@ fn f(
) {}
fn main() {
f(C, A, A, A, B, B, C); //~ ERROR this function takes 6 arguments but 7 arguments were supplied [E0061]
f(C, A, A, A, B, B, C); //~ ERROR function takes 6 arguments but 7 arguments were supplied [E0061]
f(C, C, A, A, B, B); //~ ERROR arguments to this function are incorrect [E0308]
f(A, A, D, D, B, B); //~ arguments to this function are incorrect [E0308]
f(C, C, B, B, A, A); //~ arguments to this function are incorrect [E0308]

View file

@ -5,5 +5,5 @@ fn arg<T>() -> T { todo!() }
fn main() {
let x = arg(); // `x` must be inferred
// The reference on `&x` is important to reproduce the ICE
f(&x, ""); //~ ERROR this function takes 3 arguments but 2 arguments were supplied
f(&x, ""); //~ ERROR function takes 3 arguments but 2 arguments were supplied
}

View file

@ -1,6 +1,6 @@
fn main() {
g((), ());
//~^ ERROR this function takes 6 arguments but 2 arguments were supplied
//~^ ERROR function takes 6 arguments but 2 arguments were supplied
}
pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {}

View file

@ -10,5 +10,5 @@ fn foo(a: &A, d: D, e: &E, g: G) {}
fn main() {
foo(&&A, B, C, D, E, F, G);
//~^ ERROR this function takes 4 arguments but 7 arguments were supplied
//~^ ERROR function takes 4 arguments but 7 arguments were supplied
}

View file

@ -1,4 +1,4 @@
fn main() {
(|_, ()| ())(if true {} else {return;});
//~^ ERROR this function takes 2 arguments but 1 argument was supplied
//~^ ERROR function takes 2 arguments but 1 argument was supplied
}

View file

@ -1,4 +1,4 @@
fn main() {
(|_, ()| ())([return, ()]);
//~^ ERROR this function takes 2 arguments but 1 argument was supplied
//~^ ERROR function takes 2 arguments but 1 argument was supplied
}

View file

@ -1,5 +1,5 @@
fn main() {
let f = |_: (), f: fn()| f;
let _f = f(main);
//~^ ERROR this function takes 2 arguments but 1 argument was supplied
//~^ ERROR function takes 2 arguments but 1 argument was supplied
}

View file

@ -7,34 +7,34 @@ fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {}
fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {}
fn main() {
one_arg(); //~ ERROR this function takes
one_arg(); //~ ERROR function takes
// The headers here show the types expected,
// with formatting to emphasize which arguments are missing
/* i32 f32 */
two_same( ); //~ ERROR this function takes
two_same( 1 ); //~ ERROR this function takes
two_diff( ); //~ ERROR this function takes
two_diff( 1 ); //~ ERROR this function takes
two_diff( 1.0 ); //~ ERROR this function takes
two_same( ); //~ ERROR function takes
two_same( 1 ); //~ ERROR function takes
two_diff( ); //~ ERROR function takes
two_diff( 1 ); //~ ERROR function takes
two_diff( 1.0 ); //~ ERROR function takes
/* i32 i32 i32 */
three_same( ); //~ ERROR this function takes
three_same( 1 ); //~ ERROR this function takes
three_same( 1, 1 ); //~ ERROR this function takes
three_same( ); //~ ERROR function takes
three_same( 1 ); //~ ERROR function takes
three_same( 1, 1 ); //~ ERROR function takes
/* i32 f32 &str */
three_diff( 1.0, "" ); //~ ERROR this function takes
three_diff( 1, "" ); //~ ERROR this function takes
three_diff( 1, 1.0 ); //~ ERROR this function takes
three_diff( "" ); //~ ERROR this function takes
three_diff( 1.0 ); //~ ERROR this function takes
three_diff( 1 ); //~ ERROR this function takes
three_diff( 1.0, "" ); //~ ERROR function takes
three_diff( 1, "" ); //~ ERROR function takes
three_diff( 1, 1.0 ); //~ ERROR function takes
three_diff( "" ); //~ ERROR function takes
three_diff( 1.0 ); //~ ERROR function takes
three_diff( 1 ); //~ ERROR function takes
/* i32 f32 f32 &str */
four_repeated( ); //~ ERROR this function takes
four_repeated( 1, "" ); //~ ERROR this function takes
four_repeated( ); //~ ERROR function takes
four_repeated( 1, "" ); //~ ERROR function takes
/* i32 f32 i32 f32 &str */
complex( ); //~ ERROR this function takes
complex( 1, "" ); //~ ERROR this function takes
complex( ); //~ ERROR function takes
complex( 1, "" ); //~ ERROR function takes
}

View file

@ -7,11 +7,11 @@ fn three_args(_a: i32, _b: f32, _c: &str) {}
fn main() {
// Extra + Invalid
two_args(1, "", X {}); //~ ERROR this function takes
three_args(1, "", X {}, ""); //~ ERROR this function takes
two_args(1, "", X {}); //~ ERROR function takes
three_args(1, "", X {}, ""); //~ ERROR function takes
// Missing and Invalid
three_args(1, X {}); //~ ERROR this function takes
three_args(1, X {}); //~ ERROR function takes
// Missing and Extra
three_args(1, "", X {}); //~ ERROR arguments to this function are incorrect
@ -20,5 +20,5 @@ fn main() {
three_args("", X {}, 1); //~ ERROR arguments to this function are incorrect
// Swapped and missing
three_args("", 1); //~ ERROR this function takes
three_args("", 1); //~ ERROR function takes
}

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | qux.foo(a, b, c, d, e, f, g, h, i, j, k, l);
| --- ^ expected `i32`, found `&i32`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
note: associated function defined here
--> $DIR/too-long.rs:4:8

View file

@ -32,7 +32,7 @@ error[E0308]: mismatched types
LL | fn f() { ModelT.chip_paint(Blue); }
| ---------- ^^^^ expected struct `Black`, found struct `Blue`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
note: associated function defined here
--> $DIR/associated-type-projection-from-supertrait.rs:12:8
@ -46,7 +46,7 @@ error[E0308]: mismatched types
LL | fn g() { ModelU.chip_paint(Black); }
| ---------- ^^^^^ expected struct `Blue`, found struct `Black`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
note: associated function defined here
--> $DIR/associated-type-projection-from-supertrait.rs:12:8

View file

@ -19,8 +19,8 @@ extern "C" fn bar(f: isize, x: u8) {}
fn main() {
unsafe {
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
foo(); //~ ERROR function takes at least 2 arguments but 0 arguments were supplied
foo(1); //~ ERROR 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

View file

@ -13,5 +13,5 @@ fn test<T, const P: usize>() where Bool<{core::mem::size_of::<T>() > 4}>: True {
fn main() {
test::<2>();
//~^ ERROR this function takes 2 generic arguments
//~^ ERROR function takes 2 generic arguments
}

View file

@ -4,8 +4,8 @@ fn foo<const X: usize, const Y: usize>() -> usize {
fn main() {
foo::<0>();
//~^ ERROR this function takes 2
//~^ ERROR function takes 2
foo::<0, 0, 0>();
//~^ ERROR this function takes 2
//~^ ERROR function takes 2
}

View file

@ -1,6 +1,6 @@
fn main() {
let needlesArr: Vec<char> = vec!['a', 'f'];
needlesArr.iter().fold(|x, y| {
//~^ ERROR this function takes 2 arguments but 1 argument was supplied
//~^ ERROR this method takes 2 arguments but 1 argument was supplied
});
}

View file

@ -1,4 +1,4 @@
error[E0061]: this function takes 2 arguments but 1 argument was supplied
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> $DIR/issue-3044.rs:3:23
|
LL | needlesArr.iter().fold(|x, y| {

View file

@ -14,7 +14,7 @@ fn main() {
a = d;
};
Pin::new(&mut b).resume();
//~^ ERROR this function takes 1 argument but 0 arguments were supplied
//~^ ERROR this method takes 1 argument but 0 arguments were supplied
// This type error is required to reproduce the ICE...
}

View file

@ -1,4 +1,4 @@
error[E0061]: this function takes 1 argument but 0 arguments were supplied
error[E0061]: this method takes 1 argument but 0 arguments were supplied
--> $DIR/issue-102645.rs:16:22
|
LL | Pin::new(&mut b).resume();

View file

@ -9,5 +9,5 @@ where
{}
fn main() {
f(&[f()]); //~ ERROR this function takes 1 argument
f(&[f()]); //~ ERROR function takes 1 argument
}

View file

@ -2,5 +2,5 @@ fn f<T: ?Sized, U: ?Sized>(_: impl AsRef<T>, _: impl AsRef<U>) {}
fn main() {
f::<[u8]>("a", b"a");
//~^ ERROR: this function takes 2 generic arguments but 1 generic argument was supplied
//~^ ERROR function takes 2 generic arguments but 1 generic argument was supplied
}

View file

@ -6,7 +6,7 @@ LL | c.read_to(v);
| | |
| | expected `&mut [u8]`, found struct `Vec`
| | help: consider mutably borrowing here: `&mut v`
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected mutable reference `&mut [u8]`
found struct `Vec<_>`

View file

@ -8,6 +8,6 @@ fn some_function() {} //~ NOTE defined here
fn main() {
some_macro!(some_function);
//~^ ERROR this function takes 0 arguments but 1 argument was supplied
//~^ ERROR function takes 0 arguments but 1 argument was supplied
//~| NOTE in this expansion of some_macro!
}

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | b"".starts_with(stringify!(foo))
| ----------- ^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected reference `&[u8]`
found reference `&'static str`

View file

@ -3,4 +3,4 @@
fn foo(a: usize) {}
//~^ defined here
fn main() { foo(5, 6) }
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR function takes 1 argument but 2 arguments were supplied

View file

@ -5,7 +5,7 @@ fn parse_type(iter: Box<dyn Iterator<Item=&str>+'static>) -> &str { iter.next()
fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() }
//~^ ERROR missing lifetime specifier [E0106]
//~| ERROR mismatched types
//~| ERROR this function takes 1 argument but 0 arguments were supplied
//~| ERROR function takes 1 argument but 0 arguments were supplied
fn parse_type_3() -> &str { unimplemented!() }
//~^ ERROR missing lifetime specifier [E0106]

View file

@ -23,7 +23,7 @@ error[E0308]: mismatched types
LL | 1.query::<dyn ToString>("")
| --------------------- ^^ expected trait object `dyn ToString`, found `&str`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected trait object `dyn ToString`
found reference `&'static str`

View file

@ -10,13 +10,13 @@ impl Foo {
fn main() {
let x = Foo;
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
x.zero(0) //~ ERROR this method takes 0 arguments but 1 argument was supplied
.one() //~ ERROR this method takes 1 argument but 0 arguments were supplied
.two(0); //~ ERROR this method takes 2 arguments but 1 argument was supplied
let y = Foo;
y.zero()
.take() //~ ERROR not an iterator
.one(0);
y.three::<usize>(); //~ ERROR this function takes 3 arguments but 0 arguments were supplied
y.three::<usize>(); //~ ERROR this method takes 3 arguments but 0 arguments were supplied
}

View file

@ -1,4 +1,4 @@
error[E0061]: this function takes 0 arguments but 1 argument was supplied
error[E0061]: this method takes 0 arguments but 1 argument was supplied
--> $DIR/method-call-err-msg.rs:13:7
|
LL | x.zero(0)
@ -14,7 +14,7 @@ help: remove the extra argument
LL | x.zero()
| ~~
error[E0061]: this function takes 1 argument but 0 arguments were supplied
error[E0061]: this method takes 1 argument but 0 arguments were supplied
--> $DIR/method-call-err-msg.rs:14:7
|
LL | .one()
@ -30,7 +30,7 @@ help: provide the argument
LL | .one(/* isize */)
| ~~~~~~~~~~~~~
error[E0061]: this function takes 2 arguments but 1 argument was supplied
error[E0061]: this method takes 2 arguments but 1 argument was supplied
--> $DIR/method-call-err-msg.rs:15:7
|
LL | .two(0);
@ -67,7 +67,7 @@ note: the trait `Iterator` must be implemented
= note: the following trait defines an item `take`, perhaps you need to implement it:
candidate #1: `Iterator`
error[E0061]: this function takes 3 arguments but 0 arguments were supplied
error[E0061]: this method takes 3 arguments but 0 arguments were supplied
--> $DIR/method-call-err-msg.rs:21:7
|
LL | y.three::<usize>();

View file

@ -33,9 +33,9 @@ fn main() {
let ans = s("what");
//~^ ERROR mismatched types
let ans = s();
//~^ ERROR this function takes 1 argument but 0 arguments were supplied
//~^ ERROR function takes 1 argument but 0 arguments were supplied
let ans = s("burma", "shave");
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR function takes 1 argument but 2 arguments were supplied
F("");
//~^ ERROR mismatched types

View file

@ -25,7 +25,7 @@ fn bar(
fn main() {
foo(1, 2, 3);
//~^ ERROR this function takes 4 arguments but 3
//~^ ERROR function takes 4 arguments but 3
bar(1, 2, 3);
//~^ ERROR this function takes 6 arguments but 3
//~^ ERROR function takes 6 arguments but 3
}

View 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 arguments but 1 argument was supplied
//~| ERROR function takes 0 arguments but 1 argument was supplied
// Make sure primitive type fallback doesn't work with global paths
let _: ::u8;

View file

@ -4,8 +4,8 @@ fn bar(x, y: usize) {} //~ ERROR expected one of
fn main() {
foo(Some(42), 2);
foo(Some(42), 2, ""); //~ ERROR this function takes
foo(Some(42), 2, ""); //~ ERROR function takes
bar("", ""); //~ ERROR mismatched types
bar(1, 2);
bar(1, 2, 3); //~ ERROR this function takes
bar(1, 2, 3); //~ ERROR function takes
}

View file

@ -9,9 +9,9 @@ impl S {
fn main() {
let _: Result<(), String> = Ok(); //~ ERROR this enum variant takes
foo(); //~ ERROR this function takes
foo(()); //~ ERROR this function takes
bar(); //~ ERROR this function takes
S.baz(); //~ ERROR this function takes
S.generic::<()>(); //~ ERROR this function takes
foo(); //~ ERROR function takes
foo(()); //~ ERROR function takes
bar(); //~ ERROR function takes
S.baz(); //~ ERROR this method takes
S.generic::<()>(); //~ ERROR this method takes
}

View file

@ -59,7 +59,7 @@ help: provide the argument
LL | bar(());
| ~~~~
error[E0061]: this function takes 1 argument but 0 arguments were supplied
error[E0061]: this method takes 1 argument but 0 arguments were supplied
--> $DIR/missing-unit-argument.rs:15:7
|
LL | S.baz();
@ -75,7 +75,7 @@ help: provide the argument
LL | S.baz(());
| ~~~~
error[E0061]: this function takes 1 argument but 0 arguments were supplied
error[E0061]: this method takes 1 argument but 0 arguments were supplied
--> $DIR/missing-unit-argument.rs:16:7
|
LL | S.generic::<()>();

View file

@ -6,7 +6,7 @@ fn main() {
let _: Option<(i32, bool)> = Some(1, 2);
//~^ ERROR this enum variant takes 1 argument but 2 arguments were supplied
int_bool(1, 2);
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR function takes 1 argument but 2 arguments were supplied
let _: Option<(i8,)> = Some();
//~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied

View file

@ -5,11 +5,11 @@
fn main() {
let _: Result<(i32, i8), ()> = Ok((1, 2));
//~^ ERROR this enum variant takes 1 argument but 2 arguments were supplied
//~^ ERROR enum variant takes 1 argument but 2 arguments were supplied
let _: Option<(i32, i8, &'static str)> = Some((1, 2, "hi"));
//~^ ERROR this enum variant takes 1 argument but 3 arguments were supplied
//~^ ERROR enum variant takes 1 argument but 3 arguments were supplied
let _: Option<()> = Some(());
//~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied
//~^ ERROR enum variant takes 1 argument but 0 arguments were supplied
let _: Option<(i32,)> = Some((3,));
//~^ ERROR mismatched types
@ -17,9 +17,9 @@ fn main() {
let _: Option<(i32,)> = Some((3,));
//~^ ERROR mismatched types
two_ints((1, 2)); //~ ERROR this function takes 1 argument
two_ints((1, 2)); //~ ERROR function takes 1 argument
with_generic((3, 4)); //~ ERROR this function takes 1 argument
with_generic((3, 4)); //~ ERROR function takes 1 argument
}
fn two_ints(_: (i32, i32)) {
@ -28,6 +28,6 @@ fn two_ints(_: (i32, i32)) {
fn with_generic<T: Copy + Send>((a, b): (i32, T)) {
if false {
// test generics/bound handling
with_generic((a, b)); //~ ERROR this function takes 1 argument
with_generic((a, b)); //~ ERROR function takes 1 argument
}
}

View file

@ -5,11 +5,11 @@
fn main() {
let _: Result<(i32, i8), ()> = Ok(1, 2);
//~^ ERROR this enum variant takes 1 argument but 2 arguments were supplied
//~^ ERROR enum variant takes 1 argument but 2 arguments were supplied
let _: Option<(i32, i8, &'static str)> = Some(1, 2, "hi");
//~^ ERROR this enum variant takes 1 argument but 3 arguments were supplied
//~^ ERROR enum variant takes 1 argument but 3 arguments were supplied
let _: Option<()> = Some();
//~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied
//~^ ERROR enum variant takes 1 argument but 0 arguments were supplied
let _: Option<(i32,)> = Some(3);
//~^ ERROR mismatched types
@ -17,9 +17,9 @@ fn main() {
let _: Option<(i32,)> = Some((3));
//~^ ERROR mismatched types
two_ints(1, 2); //~ ERROR this function takes 1 argument
two_ints(1, 2); //~ ERROR function takes 1 argument
with_generic(3, 4); //~ ERROR this function takes 1 argument
with_generic(3, 4); //~ ERROR function takes 1 argument
}
fn two_ints(_: (i32, i32)) {
@ -28,6 +28,6 @@ fn two_ints(_: (i32, i32)) {
fn with_generic<T: Copy + Send>((a, b): (i32, T)) {
if false {
// test generics/bound handling
with_generic(a, b); //~ ERROR this function takes 1 argument
with_generic(a, b); //~ ERROR function takes 1 argument
}
}

View file

@ -1,4 +1,4 @@
error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
error[E0061]: enum variant takes 1 argument but 2 arguments were supplied
--> $DIR/args-instead-of-tuple.rs:7:36
|
LL | let _: Result<(i32, i8), ()> = Ok(1, 2);
@ -11,7 +11,7 @@ help: wrap these arguments in parentheses to construct a tuple
LL | let _: Result<(i32, i8), ()> = Ok((1, 2));
| + +
error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied
error[E0061]: enum variant takes 1 argument but 3 arguments were supplied
--> $DIR/args-instead-of-tuple.rs:9:46
|
LL | let _: Option<(i32, i8, &'static str)> = Some(1, 2, "hi");
@ -71,7 +71,7 @@ help: use a trailing comma to create a tuple with one element
LL | let _: Option<(i32,)> = Some((3,));
| +
error[E0061]: this function takes 1 argument but 2 arguments were supplied
error[E0061]: function takes 1 argument but 2 arguments were supplied
--> $DIR/args-instead-of-tuple.rs:20:5
|
LL | two_ints(1, 2);
@ -87,7 +87,7 @@ help: wrap these arguments in parentheses to construct a tuple
LL | two_ints((1, 2));
| + +
error[E0061]: this function takes 1 argument but 2 arguments were supplied
error[E0061]: function takes 1 argument but 2 arguments were supplied
--> $DIR/args-instead-of-tuple.rs:22:5
|
LL | with_generic(3, 4);
@ -103,7 +103,7 @@ help: wrap these arguments in parentheses to construct a tuple
LL | with_generic((3, 4));
| + +
error[E0061]: this function takes 1 argument but 2 arguments were supplied
error[E0061]: function takes 1 argument but 2 arguments were supplied
--> $DIR/args-instead-of-tuple.rs:31:9
|
LL | with_generic(a, b);

View file

@ -3,6 +3,6 @@
fn two_type_params<A, B>(_: B) {}
fn main() {
two_type_params::<String, _>(100); //~ ERROR this function takes 2 generic arguments
two_type_params::<String, _>(100); //~ ERROR function takes 2 generic arguments
two_type_params::<String, _>(100);
}

View file

@ -3,6 +3,6 @@
fn two_type_params<A, B>(_: B) {}
fn main() {
two_type_params::<String>(100); //~ ERROR this function takes 2 generic arguments
two_type_params::<String>(100); //~ ERROR function takes 2 generic arguments
two_type_params::<String, _>(100);
}

View file

@ -4,7 +4,7 @@ error[E0308]: mismatched types
LL | let _s = y.unwrap_or(|| x.split('.').nth(1).unwrap());
| --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found closure
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected reference `&str`
found closure `[closure@$DIR/sugg-else-for-closure.rs:6:26: 6:28]`

View file

@ -78,7 +78,7 @@ error[E0308]: mismatched types
LL | x.funk(3);
| ---- ^ expected associated type, found integer
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected associated type `<T as Trait<i32>>::A`
found type `{integer}`

View file

@ -7,7 +7,7 @@ LL | impl<F, Name, P> AddClass<Name, F> for Class<P>
LL | builder.push(output);
| ---- ^^^^^^ expected type parameter `F`, found struct `Class`
| |
| arguments to this function are incorrect
| arguments to this method are incorrect
|
= note: expected type parameter `F`
found struct `Class<P>`

View file

@ -4,7 +4,7 @@ fn bar(s: &str, a: (&str,), s2: &str) {}
fn main() {
foo("hi", 1, 2, "hi");
//~^ ERROR this function takes 3 arguments but 4 arguments were supplied
//~^ ERROR function takes 3 arguments but 4 arguments were supplied
bar("hi", "hi", "hi");
//~^ ERROR mismatched types
}

View file

@ -1,4 +1,4 @@
error[E0061]: this function takes 3 arguments but 4 arguments were supplied
error[E0061]: function takes 3 arguments but 4 arguments were supplied
--> $DIR/add-tuple-within-arguments.rs:6:5
|
LL | foo("hi", 1, 2, "hi");

View file

@ -11,7 +11,7 @@ impl Foo {
fn bar() {
let x = Foo;
test(x.qux(), x.qux());
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR function takes 1 argument but 2 arguments were supplied
}
fn main() {}

View file

@ -1,4 +1,4 @@
error[E0061]: this function takes 1 argument but 2 arguments were supplied
error[E0061]: function takes 1 argument but 2 arguments were supplied
--> $DIR/wrong_argument_ice-2.rs:13:5
|
LL | test(x.qux(), x.qux());

View file

@ -7,7 +7,7 @@ fn test(process: &Process, groups: Vec<Group>) -> Vec<Group> {
if groups.capacity() == 0 {
groups.push(new_group, vec![process]);
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR this method takes 1 argument but 2 arguments were supplied
return groups;
}

View file

@ -1,4 +1,4 @@
error[E0061]: this function takes 1 argument but 2 arguments were supplied
error[E0061]: this method takes 1 argument but 2 arguments were supplied
--> $DIR/wrong_argument_ice-3.rs:9:16
|
LL | groups.push(new_group, vec![process]);

View file

@ -1,6 +1,6 @@
fn main() {
(|| {})(|| {
//~^ ERROR this function takes 0 arguments but 1 argument was supplied
//~^ ERROR function takes 0 arguments but 1 argument was supplied
let b = 1;
});
}

View file

@ -9,7 +9,7 @@ pub struct BuildPlanBuilder {
impl BuildPlanBuilder {
pub fn or(&mut self) -> &mut Self {
self.acc.push_back(self.current_provides, self.current_requires);
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR method takes 1 argument but 2 arguments were supplied
self
}
}

View file

@ -1,4 +1,4 @@
error[E0061]: this function takes 1 argument but 2 arguments were supplied
error[E0061]: method takes 1 argument but 2 arguments were supplied
--> $DIR/wrong_argument_ice.rs:11:18
|
LL | self.acc.push_back(self.current_provides, self.current_requires);

View file

@ -1,4 +1,4 @@
fn main() {
let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10`
//~^ ERROR this function takes 1 argument
//~^ ERROR function takes 1 argument
}

View file

@ -4,6 +4,6 @@ fn l(_a: Vec<u8>) {}
fn main() {
l(vec![])
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR function takes 1 argument but 2 arguments were supplied
//~| HELP remove the extra argument
}

View file

@ -4,6 +4,6 @@ fn l(_a: Vec<u8>) {}
fn main() {
l(vec![], vec![])
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
//~^ ERROR function takes 1 argument but 2 arguments were supplied
//~| HELP remove the extra argument
}