Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dee9aed

Browse files
authoredJun 29, 2022
Rollup merge of #97542 - compiler-errors:arg-mismatch, r=jackh726
Use typed indices in argument mismatch algorithm I kinda went overboard with the renames, but in general, "arg" is renamed to "expected", and "input" is renamed to "provided", and we use new typed indices to make sure we're indexing into the right sized array. Other drive-by changes: 1. Factor this logic into a new function, so we don't need to `break 'label` to escape it. 1. Factored out dependence on `final_arg_types`, which is never populated for arguments greater than the number of expected args. Instead, we just grab the final coerced expression type from `in_progress_typeck_results`. 1. Adjust the criteria we use to print (provided) type names, before we didn't suggest anything that had infer vars, but now we suggest thing that have infer vars but aren't `_`. ~Also, sorry in advance, I kinda want to backport this but I know I have folded in a lot of unnecessary drive-by changes that might discourage that. I would be open to brainstorming how to get some of these changes on beta at least.~ edit: Minimized the ICE-fixing changes to #97557 cc `@jackh726` as author of #92364, and `@estebank` as reviewer of the PR. fixes #97484
2 parents 45740ac + f2277e0 commit dee9aed

19 files changed

+759
-682
lines changed
 

‎compiler/rustc_typeck/src/check/fn_ctxt/arg_matrix.rs

Lines changed: 77 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11
use std::cmp;
22

3+
use rustc_index::vec::IndexVec;
34
use rustc_middle::ty::error::TypeError;
45

6+
rustc_index::newtype_index! {
7+
pub(crate) struct ExpectedIdx {
8+
DEBUG_FORMAT = "ExpectedIdx({})",
9+
}
10+
}
11+
12+
rustc_index::newtype_index! {
13+
pub(crate) struct ProvidedIdx {
14+
DEBUG_FORMAT = "ProvidedIdx({})",
15+
}
16+
}
17+
18+
impl ExpectedIdx {
19+
pub fn to_provided_idx(self) -> ProvidedIdx {
20+
ProvidedIdx::from_usize(self.as_usize())
21+
}
22+
}
23+
524
// An issue that might be found in the compatibility matrix
625
#[derive(Debug)]
726
enum Issue {
@@ -27,87 +46,89 @@ pub(crate) enum Compatibility<'tcx> {
2746
#[derive(Debug)]
2847
pub(crate) enum Error<'tcx> {
2948
/// The provided argument is the invalid type for the expected input
30-
Invalid(usize, usize, Compatibility<'tcx>), // provided, expected
49+
Invalid(ProvidedIdx, ExpectedIdx, Compatibility<'tcx>),
3150
/// There is a missing input
32-
Missing(usize),
51+
Missing(ExpectedIdx),
3352
/// There's a superfluous argument
34-
Extra(usize),
53+
Extra(ProvidedIdx),
3554
/// Two arguments should be swapped
36-
Swap(usize, usize, usize, usize),
55+
Swap(ProvidedIdx, ProvidedIdx, ExpectedIdx, ExpectedIdx),
3756
/// Several arguments should be reordered
38-
Permutation(Vec<(usize, usize)>), // dest_arg, dest_input
57+
Permutation(Vec<(ExpectedIdx, ProvidedIdx)>),
3958
}
4059

4160
pub(crate) struct ArgMatrix<'tcx> {
4261
/// Maps the indices in the `compatibility_matrix` rows to the indices of
4362
/// the *user provided* inputs
44-
input_indexes: Vec<usize>,
63+
provided_indices: Vec<ProvidedIdx>,
4564
/// Maps the indices in the `compatibility_matrix` columns to the indices
4665
/// of the *expected* args
47-
arg_indexes: Vec<usize>,
66+
expected_indices: Vec<ExpectedIdx>,
4867
/// The first dimension (rows) are the remaining user provided inputs to
4968
/// match and the second dimension (cols) are the remaining expected args
5069
/// to match
5170
compatibility_matrix: Vec<Vec<Compatibility<'tcx>>>,
5271
}
5372

5473
impl<'tcx> ArgMatrix<'tcx> {
55-
pub(crate) fn new<F: FnMut(usize, usize) -> Compatibility<'tcx>>(
56-
minimum_input_count: usize,
57-
provided_arg_count: usize,
74+
pub(crate) fn new<F: FnMut(ProvidedIdx, ExpectedIdx) -> Compatibility<'tcx>>(
75+
provided_count: usize,
76+
expected_input_count: usize,
5877
mut is_compatible: F,
5978
) -> Self {
60-
let compatibility_matrix = (0..provided_arg_count)
61-
.map(|i| (0..minimum_input_count).map(|j| is_compatible(i, j)).collect())
79+
let compatibility_matrix = (0..provided_count)
80+
.map(|i| {
81+
(0..expected_input_count)
82+
.map(|j| is_compatible(ProvidedIdx::from_usize(i), ExpectedIdx::from_usize(j)))
83+
.collect()
84+
})
6285
.collect();
6386
ArgMatrix {
64-
input_indexes: (0..provided_arg_count).collect(),
65-
arg_indexes: (0..minimum_input_count).collect(),
87+
provided_indices: (0..provided_count).map(ProvidedIdx::from_usize).collect(),
88+
expected_indices: (0..expected_input_count).map(ExpectedIdx::from_usize).collect(),
6689
compatibility_matrix,
6790
}
6891
}
6992

7093
/// Remove a given input from consideration
71-
fn eliminate_input(&mut self, idx: usize) {
72-
self.input_indexes.remove(idx);
94+
fn eliminate_provided(&mut self, idx: usize) {
95+
self.provided_indices.remove(idx);
7396
self.compatibility_matrix.remove(idx);
7497
}
7598

7699
/// Remove a given argument from consideration
77-
fn eliminate_arg(&mut self, idx: usize) {
78-
self.arg_indexes.remove(idx);
100+
fn eliminate_expected(&mut self, idx: usize) {
101+
self.expected_indices.remove(idx);
79102
for row in &mut self.compatibility_matrix {
80103
row.remove(idx);
81104
}
82105
}
83106

84107
/// "satisfy" an input with a given arg, removing both from consideration
85-
fn satisfy_input(&mut self, input_idx: usize, arg_idx: usize) {
86-
self.eliminate_input(input_idx);
87-
self.eliminate_arg(arg_idx);
108+
fn satisfy_input(&mut self, provided_idx: usize, expected_idx: usize) {
109+
self.eliminate_provided(provided_idx);
110+
self.eliminate_expected(expected_idx);
88111
}
89112

90113
// Returns a `Vec` of (user input, expected arg) of matched arguments. These
91114
// are inputs on the remaining diagonal that match.
92-
fn eliminate_satisfied(&mut self) -> Vec<(usize, usize)> {
93-
let mut i = cmp::min(self.input_indexes.len(), self.arg_indexes.len());
115+
fn eliminate_satisfied(&mut self) -> Vec<(ProvidedIdx, ExpectedIdx)> {
116+
let num_args = cmp::min(self.provided_indices.len(), self.expected_indices.len());
94117
let mut eliminated = vec![];
95-
while i > 0 {
96-
let idx = i - 1;
97-
if matches!(self.compatibility_matrix[idx][idx], Compatibility::Compatible) {
98-
eliminated.push((self.input_indexes[idx], self.arg_indexes[idx]));
99-
self.satisfy_input(idx, idx);
118+
for i in (0..num_args).rev() {
119+
if matches!(self.compatibility_matrix[i][i], Compatibility::Compatible) {
120+
eliminated.push((self.provided_indices[i], self.expected_indices[i]));
121+
self.satisfy_input(i, i);
100122
}
101-
i -= 1;
102123
}
103-
return eliminated;
124+
eliminated
104125
}
105126

106127
// Find some issue in the compatibility matrix
107128
fn find_issue(&self) -> Option<Issue> {
108129
let mat = &self.compatibility_matrix;
109-
let ai = &self.arg_indexes;
110-
let ii = &self.input_indexes;
130+
let ai = &self.expected_indices;
131+
let ii = &self.provided_indices;
111132

112133
for i in 0..cmp::max(ai.len(), ii.len()) {
113134
// If we eliminate the last row, any left-over inputs are considered missing
@@ -264,12 +285,15 @@ impl<'tcx> ArgMatrix<'tcx> {
264285
//
265286
// We'll want to know which arguments and inputs these rows and columns correspond to
266287
// even after we delete them.
267-
pub(crate) fn find_errors(mut self) -> (Vec<Error<'tcx>>, Vec<Option<usize>>) {
268-
let provided_arg_count = self.input_indexes.len();
288+
pub(crate) fn find_errors(
289+
mut self,
290+
) -> (Vec<Error<'tcx>>, IndexVec<ExpectedIdx, Option<ProvidedIdx>>) {
291+
let provided_arg_count = self.provided_indices.len();
269292

270293
let mut errors: Vec<Error<'tcx>> = vec![];
271294
// For each expected argument, the matched *actual* input
272-
let mut matched_inputs: Vec<Option<usize>> = vec![None; self.arg_indexes.len()];
295+
let mut matched_inputs: IndexVec<ExpectedIdx, Option<ProvidedIdx>> =
296+
IndexVec::from_elem_n(None, self.expected_indices.len());
273297

274298
// Before we start looking for issues, eliminate any arguments that are already satisfied,
275299
// so that an argument which is already spoken for by the input it's in doesn't
@@ -280,34 +304,34 @@ impl<'tcx> ArgMatrix<'tcx> {
280304
// Without this elimination, the first argument causes the second argument
281305
// to show up as both a missing input and extra argument, rather than
282306
// just an invalid type.
283-
for (inp, arg) in self.eliminate_satisfied() {
284-
matched_inputs[arg] = Some(inp);
307+
for (provided, expected) in self.eliminate_satisfied() {
308+
matched_inputs[expected] = Some(provided);
285309
}
286310

287-
while self.input_indexes.len() > 0 || self.arg_indexes.len() > 0 {
311+
while !self.provided_indices.is_empty() || !self.expected_indices.is_empty() {
288312
match self.find_issue() {
289313
Some(Issue::Invalid(idx)) => {
290314
let compatibility = self.compatibility_matrix[idx][idx].clone();
291-
let input_idx = self.input_indexes[idx];
292-
let arg_idx = self.arg_indexes[idx];
315+
let input_idx = self.provided_indices[idx];
316+
let arg_idx = self.expected_indices[idx];
293317
self.satisfy_input(idx, idx);
294318
errors.push(Error::Invalid(input_idx, arg_idx, compatibility));
295319
}
296320
Some(Issue::Extra(idx)) => {
297-
let input_idx = self.input_indexes[idx];
298-
self.eliminate_input(idx);
321+
let input_idx = self.provided_indices[idx];
322+
self.eliminate_provided(idx);
299323
errors.push(Error::Extra(input_idx));
300324
}
301325
Some(Issue::Missing(idx)) => {
302-
let arg_idx = self.arg_indexes[idx];
303-
self.eliminate_arg(idx);
326+
let arg_idx = self.expected_indices[idx];
327+
self.eliminate_expected(idx);
304328
errors.push(Error::Missing(arg_idx));
305329
}
306330
Some(Issue::Swap(idx, other)) => {
307-
let input_idx = self.input_indexes[idx];
308-
let other_input_idx = self.input_indexes[other];
309-
let arg_idx = self.arg_indexes[idx];
310-
let other_arg_idx = self.arg_indexes[other];
331+
let input_idx = self.provided_indices[idx];
332+
let other_input_idx = self.provided_indices[other];
333+
let arg_idx = self.expected_indices[idx];
334+
let other_arg_idx = self.expected_indices[other];
311335
let (min, max) = (cmp::min(idx, other), cmp::max(idx, other));
312336
self.satisfy_input(min, max);
313337
// Subtract 1 because we already removed the "min" row
@@ -319,13 +343,14 @@ impl<'tcx> ArgMatrix<'tcx> {
319343
Some(Issue::Permutation(args)) => {
320344
let mut idxs: Vec<usize> = args.iter().filter_map(|&a| a).collect();
321345

322-
let mut real_idxs = vec![None; provided_arg_count];
346+
let mut real_idxs: IndexVec<ProvidedIdx, Option<(ExpectedIdx, ProvidedIdx)>> =
347+
IndexVec::from_elem_n(None, provided_arg_count);
323348
for (src, dst) in
324349
args.iter().enumerate().filter_map(|(src, dst)| dst.map(|dst| (src, dst)))
325350
{
326-
let src_input_idx = self.input_indexes[src];
327-
let dst_input_idx = self.input_indexes[dst];
328-
let dest_arg_idx = self.arg_indexes[dst];
351+
let src_input_idx = self.provided_indices[src];
352+
let dst_input_idx = self.provided_indices[dst];
353+
let dest_arg_idx = self.expected_indices[dst];
329354
real_idxs[src_input_idx] = Some((dest_arg_idx, dst_input_idx));
330355
matched_inputs[dest_arg_idx] = Some(src_input_idx);
331356
}

‎compiler/rustc_typeck/src/check/fn_ctxt/checks.rs

Lines changed: 635 additions & 582 deletions
Large diffs are not rendered by default.

‎src/test/ui/argument-suggestions/basic.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
1616
--> $DIR/basic.rs:21:5
1717
|
1818
LL | extra("");
19-
| ^^^^^ -- argument unexpected
19+
| ^^^^^ -- argument of type `&'static str` unexpected
2020
|
2121
note: function defined here
2222
--> $DIR/basic.rs:14:4

‎src/test/ui/argument-suggestions/extra_arguments.stderr

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
22
--> $DIR/extra_arguments.rs:7:3
33
|
44
LL | empty("");
5-
| ^^^^^ -- argument unexpected
5+
| ^^^^^ -- argument of type `&'static str` unexpected
66
|
77
note: function defined here
88
--> $DIR/extra_arguments.rs:1:4
@@ -18,7 +18,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
1818
--> $DIR/extra_arguments.rs:9:3
1919
|
2020
LL | one_arg(1, 1);
21-
| ^^^^^^^ - argument unexpected
21+
| ^^^^^^^ - argument of type `{integer}` unexpected
2222
|
2323
note: function defined here
2424
--> $DIR/extra_arguments.rs:2:4
@@ -34,7 +34,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
3434
--> $DIR/extra_arguments.rs:10:3
3535
|
3636
LL | one_arg(1, "");
37-
| ^^^^^^^ -- argument unexpected
37+
| ^^^^^^^ -- argument of type `&'static str` unexpected
3838
|
3939
note: function defined here
4040
--> $DIR/extra_arguments.rs:2:4
@@ -50,9 +50,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
5050
--> $DIR/extra_arguments.rs:11:3
5151
|
5252
LL | one_arg(1, "", 1.0);
53-
| ^^^^^^^ -- --- argument unexpected
53+
| ^^^^^^^ -- --- argument of type `{float}` unexpected
5454
| |
55-
| argument unexpected
55+
| argument of type `&'static str` unexpected
5656
|
5757
note: function defined here
5858
--> $DIR/extra_arguments.rs:2:4
@@ -68,7 +68,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
6868
--> $DIR/extra_arguments.rs:13:3
6969
|
7070
LL | two_arg_same(1, 1, 1);
71-
| ^^^^^^^^^^^^ - argument unexpected
71+
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
7272
|
7373
note: function defined here
7474
--> $DIR/extra_arguments.rs:3:4
@@ -84,7 +84,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
8484
--> $DIR/extra_arguments.rs:14:3
8585
|
8686
LL | two_arg_same(1, 1, 1.0);
87-
| ^^^^^^^^^^^^ --- argument unexpected
87+
| ^^^^^^^^^^^^ --- argument of type `{float}` unexpected
8888
|
8989
note: function defined here
9090
--> $DIR/extra_arguments.rs:3:4
@@ -100,7 +100,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
100100
--> $DIR/extra_arguments.rs:16:3
101101
|
102102
LL | two_arg_diff(1, 1, "");
103-
| ^^^^^^^^^^^^ - argument of type `&str` unexpected
103+
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
104104
|
105105
note: function defined here
106106
--> $DIR/extra_arguments.rs:4:4
@@ -116,7 +116,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
116116
--> $DIR/extra_arguments.rs:17:3
117117
|
118118
LL | two_arg_diff(1, "", "");
119-
| ^^^^^^^^^^^^ -- argument unexpected
119+
| ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected
120120
|
121121
note: function defined here
122122
--> $DIR/extra_arguments.rs:4:4
@@ -132,9 +132,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
132132
--> $DIR/extra_arguments.rs:18:3
133133
|
134134
LL | two_arg_diff(1, 1, "", "");
135-
| ^^^^^^^^^^^^ - -- argument unexpected
135+
| ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected
136136
| |
137-
| argument of type `&str` unexpected
137+
| argument of type `{integer}` unexpected
138138
|
139139
note: function defined here
140140
--> $DIR/extra_arguments.rs:4:4
@@ -150,9 +150,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
150150
--> $DIR/extra_arguments.rs:19:3
151151
|
152152
LL | two_arg_diff(1, "", 1, "");
153-
| ^^^^^^^^^^^^ - -- argument unexpected
153+
| ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected
154154
| |
155-
| argument unexpected
155+
| argument of type `{integer}` unexpected
156156
|
157157
note: function defined here
158158
--> $DIR/extra_arguments.rs:4:4
@@ -168,7 +168,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
168168
--> $DIR/extra_arguments.rs:22:3
169169
|
170170
LL | two_arg_same(1, 1, "");
171-
| ^^^^^^^^^^^^ -- argument unexpected
171+
| ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected
172172
|
173173
note: function defined here
174174
--> $DIR/extra_arguments.rs:3:4
@@ -184,7 +184,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
184184
--> $DIR/extra_arguments.rs:23:3
185185
|
186186
LL | two_arg_diff(1, 1, "");
187-
| ^^^^^^^^^^^^ - argument of type `&str` unexpected
187+
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
188188
|
189189
note: function defined here
190190
--> $DIR/extra_arguments.rs:4:4
@@ -203,7 +203,7 @@ LL | two_arg_same(
203203
| ^^^^^^^^^^^^
204204
...
205205
LL | ""
206-
| -- argument unexpected
206+
| -- argument of type `&'static str` unexpected
207207
|
208208
note: function defined here
209209
--> $DIR/extra_arguments.rs:3:4
@@ -222,7 +222,7 @@ LL | two_arg_diff(
222222
| ^^^^^^^^^^^^
223223
LL | 1,
224224
LL | 1,
225-
| - argument of type `&str` unexpected
225+
| - argument of type `{integer}` unexpected
226226
|
227227
note: function defined here
228228
--> $DIR/extra_arguments.rs:4:4

‎src/test/ui/argument-suggestions/issue-97484.stderr

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@ error[E0061]: this function takes 4 arguments but 7 arguments were supplied
22
--> $DIR/issue-97484.rs:12:5
33
|
44
LL | foo(&&A, B, C, D, E, F, G);
5-
| ^^^ - - - argument unexpected
5+
| ^^^ - - - argument of type `F` unexpected
66
| | |
7-
| | argument of type `&E` unexpected
8-
| argument of type `D` unexpected
7+
| | argument of type `C` unexpected
8+
| argument of type `B` unexpected
99
|
1010
note: function defined here
1111
--> $DIR/issue-97484.rs:9:4
1212
|
1313
LL | fn foo(a: &A, d: D, e: &E, g: G) {}
1414
| ^^^ ----- ---- ----- ----
15-
help: consider removing the ``
16-
|
17-
LL - foo(&&A, B, C, D, E, F, G);
18-
LL + foo(&&A, B, C, D, E, F, G);
15+
help: consider borrowing here
1916
|
17+
LL | foo(&&A, B, C, D, &E, F, G);
18+
| ~~
2019
help: remove the extra arguments
2120
|
2221
LL | foo(&&A, D, /* &E */, G);

‎src/test/ui/argument-suggestions/mixed_cases.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
22
--> $DIR/mixed_cases.rs:10:3
33
|
44
LL | two_args(1, "", X {});
5-
| ^^^^^^^^ -- ---- argument unexpected
5+
| ^^^^^^^^ -- ---- argument of type `X` unexpected
66
| |
77
| expected `f32`, found `&str`
88
|
@@ -20,9 +20,9 @@ error[E0061]: this function takes 3 arguments but 4 arguments were supplied
2020
--> $DIR/mixed_cases.rs:11:3
2121
|
2222
LL | three_args(1, "", X {}, "");
23-
| ^^^^^^^^^^ -- ---- -- argument unexpected
23+
| ^^^^^^^^^^ -- ---- -- argument of type `&'static str` unexpected
2424
| | |
25-
| | argument of type `&str` unexpected
25+
| | argument of type `X` unexpected
2626
| an argument of type `f32` is missing
2727
|
2828
note: function defined here
@@ -58,7 +58,7 @@ error[E0308]: arguments to this function are incorrect
5858
--> $DIR/mixed_cases.rs:17:3
5959
|
6060
LL | three_args(1, "", X {});
61-
| ^^^^^^^^^^ -- ---- argument of type `&str` unexpected
61+
| ^^^^^^^^^^ -- ---- argument of type `X` unexpected
6262
| |
6363
| an argument of type `f32` is missing
6464
|

‎src/test/ui/error-codes/E0057.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
1818
--> $DIR/E0057.rs:5:13
1919
|
2020
LL | let c = f(2, 3);
21-
| ^ - argument unexpected
21+
| ^ - argument of type `{integer}` unexpected
2222
|
2323
note: closure defined here
2424
--> $DIR/E0057.rs:2:13

‎src/test/ui/issues/issue-26094.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
macro_rules! some_macro {
22
($other: expr) => ({
3-
$other(None) //~ NOTE argument unexpected
3+
$other(None) //~ NOTE argument of type `Option<_>` unexpected
44
})
55
}
66

‎src/test/ui/issues/issue-26094.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
22
--> $DIR/issue-26094.rs:10:17
33
|
44
LL | $other(None)
5-
| ---- argument unexpected
5+
| ---- argument of type `Option<_>` unexpected
66
...
77
LL | some_macro!(some_function);
88
| ^^^^^^^^^^^^^

‎src/test/ui/issues/issue-4935.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
22
--> $DIR/issue-4935.rs:5:13
33
|
44
LL | fn main() { foo(5, 6) }
5-
| ^^^ - argument unexpected
5+
| ^^^ - argument of type `{integer}` unexpected
66
|
77
note: function defined here
88
--> $DIR/issue-4935.rs:3:4

‎src/test/ui/methods/method-call-err-msg.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
22
--> $DIR/method-call-err-msg.rs:13:7
33
|
44
LL | x.zero(0)
5-
| ^^^^ - argument unexpected
5+
| ^^^^ - argument of type `{integer}` unexpected
66
|
77
note: associated function defined here
88
--> $DIR/method-call-err-msg.rs:5:8

‎src/test/ui/mismatched_types/overloaded-calls-bad.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
3232
--> $DIR/overloaded-calls-bad.rs:31:15
3333
|
3434
LL | let ans = s("burma", "shave");
35-
| ^ ------- ------- argument unexpected
35+
| ^ ------- ------- argument of type `&'static str` unexpected
3636
| |
3737
| expected `isize`, found `&str`
3838
|

‎src/test/ui/span/issue-34264.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
5454
--> $DIR/issue-34264.rs:7:5
5555
|
5656
LL | foo(Some(42), 2, "");
57-
| ^^^ -- argument unexpected
57+
| ^^^ -- argument of type `&'static str` unexpected
5858
|
5959
note: function defined here
6060
--> $DIR/issue-34264.rs:1:4
@@ -84,7 +84,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
8484
--> $DIR/issue-34264.rs:10:5
8585
|
8686
LL | bar(1, 2, 3);
87-
| ^^^ - argument unexpected
87+
| ^^^ - argument of type `{integer}` unexpected
8888
|
8989
note: function defined here
9090
--> $DIR/issue-34264.rs:3:4

‎src/test/ui/suggestions/args-instead-of-tuple-errors.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
22
--> $DIR/args-instead-of-tuple-errors.rs:6:34
33
|
44
LL | let _: Option<(i32, bool)> = Some(1, 2);
5-
| ^^^^ - - argument unexpected
5+
| ^^^^ - - argument of type `{integer}` unexpected
66
| |
77
| expected tuple, found integer
88
|
@@ -22,7 +22,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
2222
--> $DIR/args-instead-of-tuple-errors.rs:8:5
2323
|
2424
LL | int_bool(1, 2);
25-
| ^^^^^^^^ - - argument unexpected
25+
| ^^^^^^^^ - - argument of type `{integer}` unexpected
2626
| |
2727
| expected tuple, found integer
2828
|

‎src/test/ui/tuple/wrong_argument_ice-3.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
22
--> $DIR/wrong_argument_ice-3.rs:9:16
33
|
44
LL | groups.push(new_group, vec![process]);
5-
| ^^^^ --------- ------------- argument unexpected
5+
| ^^^^ --------- ------------- argument of type `Vec<&Process>` unexpected
66
| |
77
| expected tuple, found struct `Vec`
88
|

‎src/test/ui/tuple/wrong_argument_ice-4.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | (|| {})(|| {
66
LL | |
77
LL | | let b = 1;
88
LL | | });
9-
| |_____- argument unexpected
9+
| |_____- argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 5:6]` unexpected
1010
|
1111
note: closure defined here
1212
--> $DIR/wrong_argument_ice-4.rs:2:6

‎src/test/ui/type/type-ascription-instead-of-initializer.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
1111
--> $DIR/type-ascription-instead-of-initializer.rs:2:12
1212
|
1313
LL | let x: Vec::with_capacity(10, 20);
14-
| ^^^^^^^^^^^^^^^^^^ -- argument unexpected
14+
| ^^^^^^^^^^^^^^^^^^ -- argument of type `{integer}` unexpected
1515
|
1616
note: associated function defined here
1717
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL

‎src/test/ui/typeck/remove-extra-argument.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
22
--> $DIR/remove-extra-argument.rs:6:5
33
|
44
LL | l(vec![], vec![])
5-
| ^ ------ argument unexpected
5+
| ^ ------ argument of type `Vec<_>` unexpected
66
|
77
note: function defined here
88
--> $DIR/remove-extra-argument.rs:3:4

‎src/test/ui/typeck/struct-enum-wrong-args.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
22
--> $DIR/struct-enum-wrong-args.rs:6:13
33
|
44
LL | let _ = Some(3, 2);
5-
| ^^^^ - argument unexpected
5+
| ^^^^ - argument of type `{integer}` unexpected
66
|
77
note: tuple variant defined here
88
--> $SRC_DIR/core/src/option.rs:LL:COL
@@ -18,9 +18,9 @@ error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied
1818
--> $DIR/struct-enum-wrong-args.rs:7:13
1919
|
2020
LL | let _ = Ok(3, 6, 2);
21-
| ^^ - - argument unexpected
21+
| ^^ - - argument of type `{integer}` unexpected
2222
| |
23-
| argument unexpected
23+
| argument of type `{integer}` unexpected
2424
|
2525
note: tuple variant defined here
2626
--> $SRC_DIR/core/src/result.rs:LL:COL
@@ -68,7 +68,7 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied
6868
--> $DIR/struct-enum-wrong-args.rs:10:13
6969
|
7070
LL | let _ = Wrapper(5, 2);
71-
| ^^^^^^^ - argument unexpected
71+
| ^^^^^^^ - argument of type `{integer}` unexpected
7272
|
7373
note: tuple struct defined here
7474
--> $DIR/struct-enum-wrong-args.rs:2:8
@@ -116,7 +116,7 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied
116116
--> $DIR/struct-enum-wrong-args.rs:13:13
117117
|
118118
LL | let _ = DoubleWrapper(5, 2, 7);
119-
| ^^^^^^^^^^^^^ - argument unexpected
119+
| ^^^^^^^^^^^^^ - argument of type `{integer}` unexpected
120120
|
121121
note: tuple struct defined here
122122
--> $DIR/struct-enum-wrong-args.rs:3:8

0 commit comments

Comments
 (0)
Please sign in to comment.