Skip to content

Make missing argument placeholder more obvious that it's a placeholder #98264

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

Merged
merged 1 commit into from
Jun 20, 2022
Merged
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
4 changes: 3 additions & 1 deletion compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let input_ty = self.resolve_vars_if_possible(expected_ty);
if input_ty.is_unit() {
"()".to_string()
} else if !input_ty.is_ty_var() {
format!("/* {} */", input_ty)
} else {
format!("{{{}}}", input_ty)
"/* value */".to_string()
}
};
suggestion += &suggestion_text;
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/argument-suggestions/basic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ LL | fn missing(_i: u32) {}
| ^^^^^^^ -------
help: provide the argument
|
LL | missing({u32});
| ~~~~~~~~~~~~~~
LL | missing(/* u32 */);
| ~~~~~~~~~~~~~~~~~~

error[E0308]: arguments to this function are incorrect
--> $DIR/basic.rs:23:5
Expand Down Expand Up @@ -94,8 +94,8 @@ LL | let closure = |x| x;
| ^^^
help: provide the argument
|
LL | closure({_});
| ~~~~~~~~~~~~
LL | closure(/* value */);
| ~~~~~~~~~~~~~~~~~~~~

error: aborting due to 6 previous errors

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/argument-suggestions/complex.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {}
| ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- ------
help: did you mean
|
LL | complex({u32}, &"", {E}, F::X2, G{}, X {}, Y {}, Z {});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/argument-suggestions/issue-96638.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | fn f(_: usize, _: &usize, _: usize) {}
| ^ -------- --------- --------
help: provide the argument
|
LL | f({usize}, &x, {usize});
| ~~~~~~~~~~~~~~~~~~~~~~~
LL | f(/* usize */, &x, /* usize */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/argument-suggestions/issue-97197.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {}
| ^ ------ -------- -------- -------- -------- ------
help: provide the arguments
|
LL | g((), {bool}, {bool}, {bool}, {bool}, ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | g((), /* bool */, /* bool */, /* bool */, /* bool */, ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/argument-suggestions/issue-97484.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ LL + foo(&&A, B, C, D, E, F, G);
|
help: remove the extra arguments
|
LL | foo(&&A, D, {&E}, G);
| ~~~~~~~~~~~~~~~~~~~~
LL | foo(&&A, D, /* &E */, G);
| ~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
76 changes: 38 additions & 38 deletions src/test/ui/argument-suggestions/missing_arguments.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | fn one_arg(_a: i32) {}
| ^^^^^^^ -------
help: provide the argument
|
LL | one_arg({i32});
| ~~~~~~~~~~~~~~
LL | one_arg(/* i32 */);
| ~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 2 arguments but 0 arguments were supplied
--> $DIR/missing_arguments.rs:14:3
Expand All @@ -27,8 +27,8 @@ LL | fn two_same(_a: i32, _b: i32) {}
| ^^^^^^^^ ------- -------
help: provide the arguments
|
LL | two_same({i32}, {i32});
| ~~~~~~~~~~~~~~~~~~~~~~
LL | two_same(/* i32 */, /* i32 */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> $DIR/missing_arguments.rs:15:3
Expand All @@ -43,8 +43,8 @@ LL | fn two_same(_a: i32, _b: i32) {}
| ^^^^^^^^ ------- -------
help: provide the argument
|
LL | two_same(1, {i32});
| ~~~~~~~~~~~~~~~~~~
LL | two_same(1, /* i32 */);
| ~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 2 arguments but 0 arguments were supplied
--> $DIR/missing_arguments.rs:16:3
Expand All @@ -59,8 +59,8 @@ LL | fn two_diff(_a: i32, _b: f32) {}
| ^^^^^^^^ ------- -------
help: provide the arguments
|
LL | two_diff({i32}, {f32});
| ~~~~~~~~~~~~~~~~~~~~~~
LL | two_diff(/* i32 */, /* f32 */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> $DIR/missing_arguments.rs:17:3
Expand All @@ -75,8 +75,8 @@ LL | fn two_diff(_a: i32, _b: f32) {}
| ^^^^^^^^ ------- -------
help: provide the argument
|
LL | two_diff(1, {f32});
| ~~~~~~~~~~~~~~~~~~
LL | two_diff(1, /* f32 */);
| ~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> $DIR/missing_arguments.rs:18:3
Expand All @@ -91,8 +91,8 @@ LL | fn two_diff(_a: i32, _b: f32) {}
| ^^^^^^^^ ------- -------
help: provide the argument
|
LL | two_diff({i32}, 1.0);
| ~~~~~~~~~~~~~~~~~~~~
LL | two_diff(/* i32 */, 1.0);
| ~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 0 arguments were supplied
--> $DIR/missing_arguments.rs:21:3
Expand All @@ -107,8 +107,8 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {}
| ^^^^^^^^^^ ------- ------- -------
help: provide the arguments
|
LL | three_same({i32}, {i32}, {i32});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_same(/* i32 */, /* i32 */, /* i32 */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 1 argument was supplied
--> $DIR/missing_arguments.rs:22:3
Expand All @@ -123,8 +123,8 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {}
| ^^^^^^^^^^ ------- ------- -------
help: provide the arguments
|
LL | three_same(1, {i32}, {i32});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_same(1, /* i32 */, /* i32 */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> $DIR/missing_arguments.rs:23:3
Expand All @@ -139,8 +139,8 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {}
| ^^^^^^^^^^ ------- ------- -------
help: provide the argument
|
LL | three_same(1, 1, {i32});
| ~~~~~~~~~~~~~~~~~~~~~~~
LL | three_same(1, 1, /* i32 */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> $DIR/missing_arguments.rs:26:3
Expand All @@ -155,8 +155,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: provide the argument
|
LL | three_diff({i32}, 1.0, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_diff(/* i32 */, 1.0, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> $DIR/missing_arguments.rs:27:3
Expand All @@ -171,8 +171,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: provide the argument
|
LL | three_diff(1, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_diff(1, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> $DIR/missing_arguments.rs:28:3
Expand All @@ -187,8 +187,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: provide the argument
|
LL | three_diff(1, 1.0, {&str});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_diff(1, 1.0, /* &str */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 1 argument was supplied
--> $DIR/missing_arguments.rs:29:3
Expand All @@ -203,8 +203,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: provide the arguments
|
LL | three_diff({i32}, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_diff(/* i32 */, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 1 argument was supplied
--> $DIR/missing_arguments.rs:30:3
Expand All @@ -222,8 +222,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: provide the arguments
|
LL | three_diff({i32}, 1.0, {&str});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_diff(/* i32 */, 1.0, /* &str */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 1 argument was supplied
--> $DIR/missing_arguments.rs:31:3
Expand All @@ -238,8 +238,8 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: provide the arguments
|
LL | three_diff(1, {f32}, {&str});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_diff(1, /* f32 */, /* &str */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 4 arguments but 0 arguments were supplied
--> $DIR/missing_arguments.rs:34:3
Expand All @@ -254,8 +254,8 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {}
| ^^^^^^^^^^^^^ ------- ------- ------- --------
help: provide the arguments
|
LL | four_repeated({i32}, {f32}, {f32}, {&str});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | four_repeated(/* i32 */, /* f32 */, /* f32 */, /* &str */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 4 arguments but 2 arguments were supplied
--> $DIR/missing_arguments.rs:35:3
Expand All @@ -270,8 +270,8 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {}
| ^^^^^^^^^^^^^ ------- ------- ------- --------
help: provide the arguments
|
LL | four_repeated(1, {f32}, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | four_repeated(1, /* f32 */, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 5 arguments but 0 arguments were supplied
--> $DIR/missing_arguments.rs:38:3
Expand All @@ -286,8 +286,8 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {}
| ^^^^^^^ ------- ------- ------- ------- --------
help: provide the arguments
|
LL | complex({i32}, {f32}, {i32}, {f32}, {&str});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | complex(/* i32 */, /* f32 */, /* i32 */, /* f32 */, /* &str */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 5 arguments but 2 arguments were supplied
--> $DIR/missing_arguments.rs:39:3
Expand All @@ -302,8 +302,8 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {}
| ^^^^^^^ ------- ------- ------- ------- --------
help: provide the arguments
|
LL | complex(1, {f32}, {i32}, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | complex(1, /* f32 */, /* i32 */, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 19 previous errors

Expand Down
24 changes: 12 additions & 12 deletions src/test/ui/argument-suggestions/mixed_cases.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ LL | fn two_args(_a: i32, _b: f32) {}
| ^^^^^^^^ ------- -------
help: remove the extra argument
|
LL | two_args(1, {f32});
| ~~~~~~~~~~~~~~~~~~
LL | two_args(1, /* f32 */);
| ~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 4 arguments were supplied
--> $DIR/mixed_cases.rs:11:3
Expand All @@ -32,8 +32,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: did you mean
|
LL | three_args(1, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_args(1, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> $DIR/mixed_cases.rs:14:3
Expand All @@ -51,8 +51,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: provide the argument
|
LL | three_args(1, {f32}, {&str});
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_args(1, /* f32 */, /* &str */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: arguments to this function are incorrect
--> $DIR/mixed_cases.rs:17:3
Expand All @@ -69,8 +69,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: did you mean
|
LL | three_args(1, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_args(1, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: arguments to this function are incorrect
--> $DIR/mixed_cases.rs:20:3
Expand All @@ -88,8 +88,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: swap these arguments
|
LL | three_args(1, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_args(1, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> $DIR/mixed_cases.rs:23:3
Expand All @@ -108,8 +108,8 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
| ^^^^^^^^^^ ------- ------- --------
help: did you mean
|
LL | three_args(1, {f32}, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~
LL | three_args(1, /* f32 */, "");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 6 previous errors

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/c-variadic/variadic-ffi-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ LL | fn foo(f: isize, x: u8, ...);
| ^^^
help: provide the arguments
|
LL | foo({isize}, {u8});
| ~~~~~~~~~~~~~~~~~~
LL | foo(/* isize */, /* u8 */);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
--> $DIR/variadic-ffi-1.rs:21:9
Expand All @@ -33,8 +33,8 @@ LL | fn foo(f: isize, x: u8, ...);
| ^^^
help: provide the argument
|
LL | foo(1, {u8});
| ~~~~~~~~~~~~
LL | foo(1, /* u8 */);
| ~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
--> $DIR/variadic-ffi-1.rs:23:56
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/error-codes/E0057.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | let f = |x| x * 3;
| ^^^
help: provide the argument
|
LL | let a = f({_});
| ~~~~~~
LL | let a = f(/* value */);
| ~~~~~~~~~~~~~~

error[E0057]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/E0057.rs:5:13
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/error-codes/E0060.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LL | fn printf(_: *const u8, ...) -> u32;
| ^^^^^^
help: provide the argument
|
LL | unsafe { printf({*const u8}); }
| ~~~~~~~~~~~~~~~~~~~
LL | unsafe { printf(/* *const u8 */); }
| ~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to previous error

Expand Down
Loading