Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5fc30b8
rustdoc: click target for sidebar items flush left
notriddle Jul 2, 2024
52fb17a
Move a few intrinsics to use Rust abi
celinval Jul 4, 2024
f27023a
Document safety of a few intrinsics
celinval Jul 4, 2024
b096c08
Fix tests after intrinsic Abi change
celinval Jul 4, 2024
4fe8dd0
Remove the non-assigning form of `unpack!`
Zalathar Jul 6, 2024
1cf4eb2
Stop using `unpack!` for `BlockAnd<()>`
Zalathar Jul 6, 2024
332b41d
Use ordinal number in argument error
long-long-float May 12, 2024
247ad33
Use dep: for crate dependencies
compiler-errors Jul 15, 2024
324d2e5
Fix feature gating on rustc_index to not use implicit features
compiler-errors Jul 15, 2024
7e1c4af
The rustc crate feature is called jemalloc
compiler-errors Jul 15, 2024
3924493
rustdoc: make sidebar highlight cover whole click target
notriddle Jul 15, 2024
5514906
rustdoc: add test cases for mile wide bar
notriddle Jul 16, 2024
4821b84
If the moved value is a mut reference, it is used in a generic functi…
surechen Jul 10, 2024
40e07a3
Remove invalid further restricting for type bound
chenyukang Jul 17, 2024
2c2ef6c
add chenyukang to review rotation
chenyukang Jul 10, 2024
2b34490
Rollup merge of #125042 - long-long-float:suggest-move-arg-outside, r…
matthiaskrgr Jul 17, 2024
0472b2a
Rollup merge of #127229 - notriddle:notriddle/mile-wide-bar, r=Guilla…
matthiaskrgr Jul 17, 2024
3ddfd97
Rollup merge of #127337 - celinval:intrinsics-fallback, r=oli-obk
matthiaskrgr Jul 17, 2024
c98487e
Rollup merge of #127472 - Zalathar:block-and-unit, r=fmease
matthiaskrgr Jul 17, 2024
23dd3a0
Rollup merge of #127579 - surechen:fix_127285, r=lcnr
matthiaskrgr Jul 17, 2024
9db57bf
Rollup merge of #127769 - compiler-errors:ed-2024-dep, r=oli-obk
matthiaskrgr Jul 17, 2024
1e1e64f
Rollup merge of #127844 - chenyukang:yukang-fix-type-bound-127555, r=…
matthiaskrgr Jul 17, 2024
2ea21cf
Rollup merge of #127855 - chenyukang:yukang-add-triagebot, r=jieyouxu
matthiaskrgr Jul 17, 2024
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
19 changes: 17 additions & 2 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
"".to_string()
};
labels.push((provided_span, format!("unexpected argument{provided_ty_name}")));
let idx = if provided_arg_tys.len() == 1 {
"".to_string()
} else {
format!(" #{}", arg_idx.as_usize() + 1)
};
labels.push((
provided_span,
format!("unexpected argument{idx}{provided_ty_name}"),
));
let mut span = provided_span;
if span.can_be_used_for_suggestions()
&& error_span.can_be_used_for_suggestions()
Expand Down Expand Up @@ -1186,7 +1194,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} else {
"".to_string()
};
labels.push((span, format!("an argument{rendered} is missing")));
labels.push((
span,
format!(
"argument #{}{rendered} is missing",
expected_idx.as_usize() + 1
),
));

suggestion_text = match suggestion_text {
SuggestionText::None => SuggestionText::Provide(false),
SuggestionText::Provide(_) => SuggestionText::Provide(true),
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/argument-suggestions/basic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> $DIR/basic.rs:22:5
|
LL | missing();
| ^^^^^^^-- an argument of type `u32` is missing
| ^^^^^^^-- argument #1 of type `u32` is missing
|
note: function defined here
--> $DIR/basic.rs:15:4
Expand Down Expand Up @@ -86,7 +86,7 @@ error[E0057]: this function takes 1 argument but 0 arguments were supplied
--> $DIR/basic.rs:27:5
|
LL | closure();
| ^^^^^^^-- an argument is missing
| ^^^^^^^-- argument #1 is missing
|
note: closure defined here
--> $DIR/basic.rs:26:19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 0 arguments were supplied
--> $DIR/display-is-suggestable.rs:6:5
|
LL | foo();
| ^^^-- an argument of type `&dyn std::fmt::Display + Send` is missing
| ^^^-- argument #1 of type `&dyn std::fmt::Display + Send` is missing
|
note: function defined here
--> $DIR/display-is-suggestable.rs:3:4
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/argument-suggestions/extern-fn-arg-names.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ error[E0061]: this function takes 2 arguments but 1 argument was supplied
--> $DIR/extern-fn-arg-names.rs:7:5
|
LL | dstfn(1);
| ^^^^^--- an argument is missing
| ^^^^^--- argument #2 is missing
|
note: function defined here
--> $DIR/extern-fn-arg-names.rs:2:8
Expand Down
56 changes: 28 additions & 28 deletions tests/ui/argument-suggestions/extra_arguments.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ error[E0061]: this function takes 0 arguments but 2 arguments were supplied
--> $DIR/extra_arguments.rs:20:3
|
LL | empty(1, 1);
| ^^^^^ - - unexpected argument of type `{integer}`
| ^^^^^ - - unexpected argument #2 of type `{integer}`
| |
| unexpected argument of type `{integer}`
| unexpected argument #1 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:1:4
Expand All @@ -38,7 +38,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:22:3
|
LL | one_arg(1, 1);
| ^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^ - unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
Expand All @@ -55,7 +55,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:23:3
|
LL | one_arg(1, "");
| ^^^^^^^ -- unexpected argument of type `&'static str`
| ^^^^^^^ -- unexpected argument #2 of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
Expand All @@ -72,9 +72,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
--> $DIR/extra_arguments.rs:24:3
|
LL | one_arg(1, "", 1.0);
| ^^^^^^^ -- --- unexpected argument of type `{float}`
| ^^^^^^^ -- --- unexpected argument #3 of type `{float}`
| |
| unexpected argument of type `&'static str`
| unexpected argument #2 of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
Expand All @@ -91,7 +91,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:26:3
|
LL | two_arg_same(1, 1, 1);
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^^^^^^ - unexpected argument #3 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
Expand All @@ -108,7 +108,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:27:3
|
LL | two_arg_same(1, 1, 1.0);
| ^^^^^^^^^^^^ --- unexpected argument of type `{float}`
| ^^^^^^^^^^^^ --- unexpected argument #3 of type `{float}`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
Expand All @@ -125,7 +125,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:29:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^^^^^^ - unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
Expand All @@ -142,7 +142,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:30:3
|
LL | two_arg_diff(1, "", "");
| ^^^^^^^^^^^^ -- unexpected argument of type `&'static str`
| ^^^^^^^^^^^^ -- unexpected argument #3 of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
Expand All @@ -159,9 +159,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
--> $DIR/extra_arguments.rs:31:3
|
LL | two_arg_diff(1, 1, "", "");
| ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str`
| ^^^^^^^^^^^^ - -- unexpected argument #4 of type `&'static str`
| |
| unexpected argument of type `{integer}`
| unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
Expand All @@ -178,9 +178,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
--> $DIR/extra_arguments.rs:32:3
|
LL | two_arg_diff(1, "", 1, "");
| ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str`
| ^^^^^^^^^^^^ - -- unexpected argument #4 of type `&'static str`
| |
| unexpected argument of type `{integer}`
| unexpected argument #3 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
Expand All @@ -197,7 +197,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:35:3
|
LL | two_arg_same(1, 1, "");
| ^^^^^^^^^^^^ -- unexpected argument of type `&'static str`
| ^^^^^^^^^^^^ -- unexpected argument #3 of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
Expand All @@ -214,7 +214,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:36:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^^^^^^ - unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
Expand All @@ -234,7 +234,7 @@ LL | two_arg_same(
| ^^^^^^^^^^^^
...
LL | ""
| -- unexpected argument of type `&'static str`
| -- unexpected argument #3 of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
Expand All @@ -255,7 +255,7 @@ LL | two_arg_diff(
| ^^^^^^^^^^^^
LL | 1,
LL | 1,
| - unexpected argument of type `{integer}`
| - unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
Expand All @@ -271,12 +271,12 @@ error[E0061]: this function takes 0 arguments but 2 arguments were supplied
--> $DIR/extra_arguments.rs:8:9
|
LL | empty($x, 1);
| ^^^^^ - unexpected argument of type `{integer}`
| ^^^^^ - unexpected argument #2 of type `{integer}`
...
LL | foo!(1, ~);
| ----------
| | |
| | unexpected argument of type `{integer}`
| | unexpected argument #1 of type `{integer}`
| in this macro invocation
|
note: function defined here
Expand All @@ -290,12 +290,12 @@ error[E0061]: this function takes 0 arguments but 2 arguments were supplied
--> $DIR/extra_arguments.rs:14:9
|
LL | empty(1, $y);
| ^^^^^ - unexpected argument of type `{integer}`
| ^^^^^ - unexpected argument #1 of type `{integer}`
...
LL | foo!(~, 1);
| ----------
| | |
| | unexpected argument of type `{integer}`
| | unexpected argument #2 of type `{integer}`
| in this macro invocation
|
note: function defined here
Expand All @@ -314,8 +314,8 @@ LL | empty($x, $y);
LL | foo!(1, 1);
| ----------
| | | |
| | | unexpected argument of type `{integer}`
| | unexpected argument of type `{integer}`
| | | unexpected argument #2 of type `{integer}`
| | unexpected argument #1 of type `{integer}`
| in this macro invocation
|
note: function defined here
Expand All @@ -329,7 +329,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:53:3
|
LL | one_arg(1, panic!());
| ^^^^^^^ -------- unexpected argument
| ^^^^^^^ -------- unexpected argument #2
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
Expand All @@ -346,7 +346,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:54:3
|
LL | one_arg(panic!(), 1);
| ^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^ - unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
Expand All @@ -363,7 +363,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:55:3
|
LL | one_arg(stringify!($e), 1);
| ^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^ - unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
Expand All @@ -380,7 +380,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:60:3
|
LL | one_arg(for _ in 1.. {}, 1);
| ^^^^^^^ - unexpected argument of type `{integer}`
| ^^^^^^^ - unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/argument-suggestions/issue-100478.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ error[E0061]: this function takes 3 arguments but 1 argument was supplied
LL | three_diff(T2::new(0));
| ^^^^^^^^^^------------
| ||
| |an argument of type `T1` is missing
| an argument of type `T3` is missing
| |argument #1 of type `T1` is missing
| argument #3 of type `T3` is missing
|
note: function defined here
--> $DIR/issue-100478.rs:30:4
Expand Down Expand Up @@ -63,7 +63,7 @@ LL | foo(
| ^^^
...
LL | p3, p4, p5, p6, p7, p8,
| -- an argument of type `Arc<T2>` is missing
| -- argument #2 of type `Arc<T2>` is missing
|
note: function defined here
--> $DIR/issue-100478.rs:29:4
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/argument-suggestions/issue-101097.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0061]: this function takes 6 arguments but 7 arguments were supplied
LL | f(C, A, A, A, B, B, C);
| ^ - - - - expected `C`, found `B`
| | | |
| | | unexpected argument of type `A`
| | | unexpected argument #4 of type `A`
| | expected `B`, found `A`
| expected `A`, found `C`
|
Expand Down Expand Up @@ -64,8 +64,8 @@ error[E0308]: arguments to this function are incorrect
LL | f(A, A, D, D, B, B);
| ^ - - ---- two arguments of type `C` and `C` are missing
| | |
| | unexpected argument of type `D`
| unexpected argument of type `D`
| | unexpected argument #4 of type `D`
| unexpected argument #3 of type `D`
|
note: function defined here
--> $DIR/issue-101097.rs:6:4
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/argument-suggestions/issue-109425.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ error[E0061]: this function takes 0 arguments but 2 arguments were supplied
--> $DIR/issue-109425.rs:10:5
|
LL | f(0, 1,); // f()
| ^ - - unexpected argument of type `{integer}`
| ^ - - unexpected argument #2 of type `{integer}`
| |
| unexpected argument of type `{integer}`
| unexpected argument #1 of type `{integer}`
|
note: function defined here
--> $DIR/issue-109425.rs:3:4
Expand All @@ -21,9 +21,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
--> $DIR/issue-109425.rs:12:5
|
LL | i(0, 1, 2,); // i(0,)
| ^ - - unexpected argument of type `{integer}`
| ^ - - unexpected argument #3 of type `{integer}`
| |
| unexpected argument of type `{integer}`
| unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/issue-109425.rs:4:4
Expand All @@ -40,9 +40,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
--> $DIR/issue-109425.rs:14:5
|
LL | i(0, 1, 2); // i(0)
| ^ - - unexpected argument of type `{integer}`
| ^ - - unexpected argument #3 of type `{integer}`
| |
| unexpected argument of type `{integer}`
| unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/issue-109425.rs:4:4
Expand All @@ -59,9 +59,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
--> $DIR/issue-109425.rs:16:5
|
LL | is(0, 1, 2, ""); // is(0, "")
| ^^ - - unexpected argument of type `{integer}`
| ^^ - - unexpected argument #3 of type `{integer}`
| |
| unexpected argument of type `{integer}`
| unexpected argument #2 of type `{integer}`
|
note: function defined here
--> $DIR/issue-109425.rs:5:4
Expand All @@ -78,9 +78,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
--> $DIR/issue-109425.rs:18:5
|
LL | s(0, 1, ""); // s("")
| ^ - - unexpected argument of type `{integer}`
| ^ - - unexpected argument #2 of type `{integer}`
| |
| unexpected argument of type `{integer}`
| unexpected argument #1 of type `{integer}`
|
note: function defined here
--> $DIR/issue-109425.rs:6:4
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/argument-suggestions/issue-109831.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ error[E0061]: this function takes 3 arguments but 4 arguments were supplied
--> $DIR/issue-109831.rs:7:5
|
LL | f(A, A, B, C);
| ^ - - - unexpected argument
| ^ - - - unexpected argument #4
| | |
| | expected `B`, found `A`
| expected `B`, found `A`
Expand Down
Loading