mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
Use typed indices in argument mismatch algorithm
This commit is contained in:
parent
7f08d04d60
commit
f2277e03ee
@ -1,7 +1,26 @@
|
||||
use std::cmp;
|
||||
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_middle::ty::error::TypeError;
|
||||
|
||||
rustc_index::newtype_index! {
|
||||
pub(crate) struct ExpectedIdx {
|
||||
DEBUG_FORMAT = "ExpectedIdx({})",
|
||||
}
|
||||
}
|
||||
|
||||
rustc_index::newtype_index! {
|
||||
pub(crate) struct ProvidedIdx {
|
||||
DEBUG_FORMAT = "ProvidedIdx({})",
|
||||
}
|
||||
}
|
||||
|
||||
impl ExpectedIdx {
|
||||
pub fn to_provided_idx(self) -> ProvidedIdx {
|
||||
ProvidedIdx::from_usize(self.as_usize())
|
||||
}
|
||||
}
|
||||
|
||||
// An issue that might be found in the compatibility matrix
|
||||
#[derive(Debug)]
|
||||
enum Issue {
|
||||
@ -27,24 +46,24 @@ pub(crate) enum Compatibility<'tcx> {
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum Error<'tcx> {
|
||||
/// The provided argument is the invalid type for the expected input
|
||||
Invalid(usize, usize, Compatibility<'tcx>), // provided, expected
|
||||
Invalid(ProvidedIdx, ExpectedIdx, Compatibility<'tcx>),
|
||||
/// There is a missing input
|
||||
Missing(usize),
|
||||
Missing(ExpectedIdx),
|
||||
/// There's a superfluous argument
|
||||
Extra(usize),
|
||||
Extra(ProvidedIdx),
|
||||
/// Two arguments should be swapped
|
||||
Swap(usize, usize, usize, usize),
|
||||
Swap(ProvidedIdx, ProvidedIdx, ExpectedIdx, ExpectedIdx),
|
||||
/// Several arguments should be reordered
|
||||
Permutation(Vec<(usize, usize)>), // dest_arg, dest_input
|
||||
Permutation(Vec<(ExpectedIdx, ProvidedIdx)>),
|
||||
}
|
||||
|
||||
pub(crate) struct ArgMatrix<'tcx> {
|
||||
/// Maps the indices in the `compatibility_matrix` rows to the indices of
|
||||
/// the *user provided* inputs
|
||||
input_indexes: Vec<usize>,
|
||||
provided_indices: Vec<ProvidedIdx>,
|
||||
/// Maps the indices in the `compatibility_matrix` columns to the indices
|
||||
/// of the *expected* args
|
||||
arg_indexes: Vec<usize>,
|
||||
expected_indices: Vec<ExpectedIdx>,
|
||||
/// The first dimension (rows) are the remaining user provided inputs to
|
||||
/// match and the second dimension (cols) are the remaining expected args
|
||||
/// to match
|
||||
@ -52,62 +71,64 @@ pub(crate) struct ArgMatrix<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> ArgMatrix<'tcx> {
|
||||
pub(crate) fn new<F: FnMut(usize, usize) -> Compatibility<'tcx>>(
|
||||
minimum_input_count: usize,
|
||||
provided_arg_count: usize,
|
||||
pub(crate) fn new<F: FnMut(ProvidedIdx, ExpectedIdx) -> Compatibility<'tcx>>(
|
||||
provided_count: usize,
|
||||
expected_input_count: usize,
|
||||
mut is_compatible: F,
|
||||
) -> Self {
|
||||
let compatibility_matrix = (0..provided_arg_count)
|
||||
.map(|i| (0..minimum_input_count).map(|j| is_compatible(i, j)).collect())
|
||||
let compatibility_matrix = (0..provided_count)
|
||||
.map(|i| {
|
||||
(0..expected_input_count)
|
||||
.map(|j| is_compatible(ProvidedIdx::from_usize(i), ExpectedIdx::from_usize(j)))
|
||||
.collect()
|
||||
})
|
||||
.collect();
|
||||
ArgMatrix {
|
||||
input_indexes: (0..provided_arg_count).collect(),
|
||||
arg_indexes: (0..minimum_input_count).collect(),
|
||||
provided_indices: (0..provided_count).map(ProvidedIdx::from_usize).collect(),
|
||||
expected_indices: (0..expected_input_count).map(ExpectedIdx::from_usize).collect(),
|
||||
compatibility_matrix,
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove a given input from consideration
|
||||
fn eliminate_input(&mut self, idx: usize) {
|
||||
self.input_indexes.remove(idx);
|
||||
fn eliminate_provided(&mut self, idx: usize) {
|
||||
self.provided_indices.remove(idx);
|
||||
self.compatibility_matrix.remove(idx);
|
||||
}
|
||||
|
||||
/// Remove a given argument from consideration
|
||||
fn eliminate_arg(&mut self, idx: usize) {
|
||||
self.arg_indexes.remove(idx);
|
||||
fn eliminate_expected(&mut self, idx: usize) {
|
||||
self.expected_indices.remove(idx);
|
||||
for row in &mut self.compatibility_matrix {
|
||||
row.remove(idx);
|
||||
}
|
||||
}
|
||||
|
||||
/// "satisfy" an input with a given arg, removing both from consideration
|
||||
fn satisfy_input(&mut self, input_idx: usize, arg_idx: usize) {
|
||||
self.eliminate_input(input_idx);
|
||||
self.eliminate_arg(arg_idx);
|
||||
fn satisfy_input(&mut self, provided_idx: usize, expected_idx: usize) {
|
||||
self.eliminate_provided(provided_idx);
|
||||
self.eliminate_expected(expected_idx);
|
||||
}
|
||||
|
||||
// Returns a `Vec` of (user input, expected arg) of matched arguments. These
|
||||
// are inputs on the remaining diagonal that match.
|
||||
fn eliminate_satisfied(&mut self) -> Vec<(usize, usize)> {
|
||||
let mut i = cmp::min(self.input_indexes.len(), self.arg_indexes.len());
|
||||
fn eliminate_satisfied(&mut self) -> Vec<(ProvidedIdx, ExpectedIdx)> {
|
||||
let num_args = cmp::min(self.provided_indices.len(), self.expected_indices.len());
|
||||
let mut eliminated = vec![];
|
||||
while i > 0 {
|
||||
let idx = i - 1;
|
||||
if matches!(self.compatibility_matrix[idx][idx], Compatibility::Compatible) {
|
||||
eliminated.push((self.input_indexes[idx], self.arg_indexes[idx]));
|
||||
self.satisfy_input(idx, idx);
|
||||
for i in (0..num_args).rev() {
|
||||
if matches!(self.compatibility_matrix[i][i], Compatibility::Compatible) {
|
||||
eliminated.push((self.provided_indices[i], self.expected_indices[i]));
|
||||
self.satisfy_input(i, i);
|
||||
}
|
||||
i -= 1;
|
||||
}
|
||||
return eliminated;
|
||||
eliminated
|
||||
}
|
||||
|
||||
// Find some issue in the compatibility matrix
|
||||
fn find_issue(&self) -> Option<Issue> {
|
||||
let mat = &self.compatibility_matrix;
|
||||
let ai = &self.arg_indexes;
|
||||
let ii = &self.input_indexes;
|
||||
let ai = &self.expected_indices;
|
||||
let ii = &self.provided_indices;
|
||||
|
||||
for i in 0..cmp::max(ai.len(), ii.len()) {
|
||||
// If we eliminate the last row, any left-over inputs are considered missing
|
||||
@ -264,12 +285,15 @@ impl<'tcx> ArgMatrix<'tcx> {
|
||||
//
|
||||
// We'll want to know which arguments and inputs these rows and columns correspond to
|
||||
// even after we delete them.
|
||||
pub(crate) fn find_errors(mut self) -> (Vec<Error<'tcx>>, Vec<Option<usize>>) {
|
||||
let provided_arg_count = self.input_indexes.len();
|
||||
pub(crate) fn find_errors(
|
||||
mut self,
|
||||
) -> (Vec<Error<'tcx>>, IndexVec<ExpectedIdx, Option<ProvidedIdx>>) {
|
||||
let provided_arg_count = self.provided_indices.len();
|
||||
|
||||
let mut errors: Vec<Error<'tcx>> = vec![];
|
||||
// For each expected argument, the matched *actual* input
|
||||
let mut matched_inputs: Vec<Option<usize>> = vec![None; self.arg_indexes.len()];
|
||||
let mut matched_inputs: IndexVec<ExpectedIdx, Option<ProvidedIdx>> =
|
||||
IndexVec::from_elem_n(None, self.expected_indices.len());
|
||||
|
||||
// Before we start looking for issues, eliminate any arguments that are already satisfied,
|
||||
// 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> {
|
||||
// Without this elimination, the first argument causes the second argument
|
||||
// to show up as both a missing input and extra argument, rather than
|
||||
// just an invalid type.
|
||||
for (inp, arg) in self.eliminate_satisfied() {
|
||||
matched_inputs[arg] = Some(inp);
|
||||
for (provided, expected) in self.eliminate_satisfied() {
|
||||
matched_inputs[expected] = Some(provided);
|
||||
}
|
||||
|
||||
while self.input_indexes.len() > 0 || self.arg_indexes.len() > 0 {
|
||||
while !self.provided_indices.is_empty() || !self.expected_indices.is_empty() {
|
||||
match self.find_issue() {
|
||||
Some(Issue::Invalid(idx)) => {
|
||||
let compatibility = self.compatibility_matrix[idx][idx].clone();
|
||||
let input_idx = self.input_indexes[idx];
|
||||
let arg_idx = self.arg_indexes[idx];
|
||||
let input_idx = self.provided_indices[idx];
|
||||
let arg_idx = self.expected_indices[idx];
|
||||
self.satisfy_input(idx, idx);
|
||||
errors.push(Error::Invalid(input_idx, arg_idx, compatibility));
|
||||
}
|
||||
Some(Issue::Extra(idx)) => {
|
||||
let input_idx = self.input_indexes[idx];
|
||||
self.eliminate_input(idx);
|
||||
let input_idx = self.provided_indices[idx];
|
||||
self.eliminate_provided(idx);
|
||||
errors.push(Error::Extra(input_idx));
|
||||
}
|
||||
Some(Issue::Missing(idx)) => {
|
||||
let arg_idx = self.arg_indexes[idx];
|
||||
self.eliminate_arg(idx);
|
||||
let arg_idx = self.expected_indices[idx];
|
||||
self.eliminate_expected(idx);
|
||||
errors.push(Error::Missing(arg_idx));
|
||||
}
|
||||
Some(Issue::Swap(idx, other)) => {
|
||||
let input_idx = self.input_indexes[idx];
|
||||
let other_input_idx = self.input_indexes[other];
|
||||
let arg_idx = self.arg_indexes[idx];
|
||||
let other_arg_idx = self.arg_indexes[other];
|
||||
let input_idx = self.provided_indices[idx];
|
||||
let other_input_idx = self.provided_indices[other];
|
||||
let arg_idx = self.expected_indices[idx];
|
||||
let other_arg_idx = self.expected_indices[other];
|
||||
let (min, max) = (cmp::min(idx, other), cmp::max(idx, other));
|
||||
self.satisfy_input(min, max);
|
||||
// Subtract 1 because we already removed the "min" row
|
||||
@ -319,13 +343,14 @@ impl<'tcx> ArgMatrix<'tcx> {
|
||||
Some(Issue::Permutation(args)) => {
|
||||
let mut idxs: Vec<usize> = args.iter().filter_map(|&a| a).collect();
|
||||
|
||||
let mut real_idxs = vec![None; provided_arg_count];
|
||||
let mut real_idxs: IndexVec<ProvidedIdx, Option<(ExpectedIdx, ProvidedIdx)>> =
|
||||
IndexVec::from_elem_n(None, provided_arg_count);
|
||||
for (src, dst) in
|
||||
args.iter().enumerate().filter_map(|(src, dst)| dst.map(|dst| (src, dst)))
|
||||
{
|
||||
let src_input_idx = self.input_indexes[src];
|
||||
let dst_input_idx = self.input_indexes[dst];
|
||||
let dest_arg_idx = self.arg_indexes[dst];
|
||||
let src_input_idx = self.provided_indices[src];
|
||||
let dst_input_idx = self.provided_indices[dst];
|
||||
let dest_arg_idx = self.expected_indices[dst];
|
||||
real_idxs[src_input_idx] = Some((dest_arg_idx, dst_input_idx));
|
||||
matched_inputs[dest_arg_idx] = Some(src_input_idx);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/basic.rs:21:5
|
||||
|
|
||||
LL | extra("");
|
||||
| ^^^^^ -- argument unexpected
|
||||
| ^^^^^ -- argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/basic.rs:14:4
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/extra_arguments.rs:7:3
|
||||
|
|
||||
LL | empty("");
|
||||
| ^^^^^ -- argument unexpected
|
||||
| ^^^^^ -- argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:1:4
|
||||
@ -18,7 +18,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:9:3
|
||||
|
|
||||
LL | one_arg(1, 1);
|
||||
| ^^^^^^^ - argument unexpected
|
||||
| ^^^^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:2:4
|
||||
@ -34,7 +34,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:10:3
|
||||
|
|
||||
LL | one_arg(1, "");
|
||||
| ^^^^^^^ -- argument unexpected
|
||||
| ^^^^^^^ -- argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:2:4
|
||||
@ -50,9 +50,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:11:3
|
||||
|
|
||||
LL | one_arg(1, "", 1.0);
|
||||
| ^^^^^^^ -- --- argument unexpected
|
||||
| ^^^^^^^ -- --- argument of type `{float}` unexpected
|
||||
| |
|
||||
| argument unexpected
|
||||
| argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:2:4
|
||||
@ -68,7 +68,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:13:3
|
||||
|
|
||||
LL | two_arg_same(1, 1, 1);
|
||||
| ^^^^^^^^^^^^ - argument unexpected
|
||||
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:3:4
|
||||
@ -84,7 +84,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:14:3
|
||||
|
|
||||
LL | two_arg_same(1, 1, 1.0);
|
||||
| ^^^^^^^^^^^^ --- argument unexpected
|
||||
| ^^^^^^^^^^^^ --- argument of type `{float}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:3:4
|
||||
@ -100,7 +100,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:16:3
|
||||
|
|
||||
LL | two_arg_diff(1, 1, "");
|
||||
| ^^^^^^^^^^^^ - argument of type `&str` unexpected
|
||||
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:4:4
|
||||
@ -116,7 +116,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:17:3
|
||||
|
|
||||
LL | two_arg_diff(1, "", "");
|
||||
| ^^^^^^^^^^^^ -- argument unexpected
|
||||
| ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:4:4
|
||||
@ -132,9 +132,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:18:3
|
||||
|
|
||||
LL | two_arg_diff(1, 1, "", "");
|
||||
| ^^^^^^^^^^^^ - -- argument unexpected
|
||||
| ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected
|
||||
| |
|
||||
| argument of type `&str` unexpected
|
||||
| argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:4:4
|
||||
@ -150,9 +150,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:19:3
|
||||
|
|
||||
LL | two_arg_diff(1, "", 1, "");
|
||||
| ^^^^^^^^^^^^ - -- argument unexpected
|
||||
| ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected
|
||||
| |
|
||||
| argument unexpected
|
||||
| argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:4:4
|
||||
@ -168,7 +168,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:22:3
|
||||
|
|
||||
LL | two_arg_same(1, 1, "");
|
||||
| ^^^^^^^^^^^^ -- argument unexpected
|
||||
| ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:3:4
|
||||
@ -184,7 +184,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/extra_arguments.rs:23:3
|
||||
|
|
||||
LL | two_arg_diff(1, 1, "");
|
||||
| ^^^^^^^^^^^^ - argument of type `&str` unexpected
|
||||
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:4:4
|
||||
@ -203,7 +203,7 @@ LL | two_arg_same(
|
||||
| ^^^^^^^^^^^^
|
||||
...
|
||||
LL | ""
|
||||
| -- argument unexpected
|
||||
| -- argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:3:4
|
||||
@ -222,7 +222,7 @@ LL | two_arg_diff(
|
||||
| ^^^^^^^^^^^^
|
||||
LL | 1,
|
||||
LL | 1,
|
||||
| - argument of type `&str` unexpected
|
||||
| - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/extra_arguments.rs:4:4
|
||||
|
@ -2,21 +2,20 @@ error[E0061]: this function takes 4 arguments but 7 arguments were supplied
|
||||
--> $DIR/issue-97484.rs:12:5
|
||||
|
|
||||
LL | foo(&&A, B, C, D, E, F, G);
|
||||
| ^^^ - - - argument unexpected
|
||||
| ^^^ - - - argument of type `F` unexpected
|
||||
| | |
|
||||
| | argument of type `&E` unexpected
|
||||
| argument of type `D` unexpected
|
||||
| | argument of type `C` unexpected
|
||||
| argument of type `B` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/issue-97484.rs:9:4
|
||||
|
|
||||
LL | fn foo(a: &A, d: D, e: &E, g: G) {}
|
||||
| ^^^ ----- ---- ----- ----
|
||||
help: consider removing the ``
|
||||
|
|
||||
LL - foo(&&A, B, C, D, E, F, G);
|
||||
LL + foo(&&A, B, C, D, E, F, G);
|
||||
help: consider borrowing here
|
||||
|
|
||||
LL | foo(&&A, B, C, D, &E, F, G);
|
||||
| ~~
|
||||
help: remove the extra arguments
|
||||
|
|
||||
LL | foo(&&A, D, /* &E */, G);
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/mixed_cases.rs:10:3
|
||||
|
|
||||
LL | two_args(1, "", X {});
|
||||
| ^^^^^^^^ -- ---- argument unexpected
|
||||
| ^^^^^^^^ -- ---- argument of type `X` unexpected
|
||||
| |
|
||||
| expected `f32`, found `&str`
|
||||
|
|
||||
@ -20,9 +20,9 @@ error[E0061]: this function takes 3 arguments but 4 arguments were supplied
|
||||
--> $DIR/mixed_cases.rs:11:3
|
||||
|
|
||||
LL | three_args(1, "", X {}, "");
|
||||
| ^^^^^^^^^^ -- ---- -- argument unexpected
|
||||
| ^^^^^^^^^^ -- ---- -- argument of type `&'static str` unexpected
|
||||
| | |
|
||||
| | argument of type `&str` unexpected
|
||||
| | argument of type `X` unexpected
|
||||
| an argument of type `f32` is missing
|
||||
|
|
||||
note: function defined here
|
||||
@ -58,7 +58,7 @@ error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/mixed_cases.rs:17:3
|
||||
|
|
||||
LL | three_args(1, "", X {});
|
||||
| ^^^^^^^^^^ -- ---- argument of type `&str` unexpected
|
||||
| ^^^^^^^^^^ -- ---- argument of type `X` unexpected
|
||||
| |
|
||||
| an argument of type `f32` is missing
|
||||
|
|
||||
|
@ -18,7 +18,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/E0057.rs:5:13
|
||||
|
|
||||
LL | let c = f(2, 3);
|
||||
| ^ - argument unexpected
|
||||
| ^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: closure defined here
|
||||
--> $DIR/E0057.rs:2:13
|
||||
|
@ -1,6 +1,6 @@
|
||||
macro_rules! some_macro {
|
||||
($other: expr) => ({
|
||||
$other(None) //~ NOTE argument unexpected
|
||||
$other(None) //~ NOTE argument of type `Option<_>` unexpected
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/issue-26094.rs:10:17
|
||||
|
|
||||
LL | $other(None)
|
||||
| ---- argument unexpected
|
||||
| ---- argument of type `Option<_>` unexpected
|
||||
...
|
||||
LL | some_macro!(some_function);
|
||||
| ^^^^^^^^^^^^^
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/issue-4935.rs:5:13
|
||||
|
|
||||
LL | fn main() { foo(5, 6) }
|
||||
| ^^^ - argument unexpected
|
||||
| ^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/issue-4935.rs:3:4
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/method-call-err-msg.rs:13:7
|
||||
|
|
||||
LL | x.zero(0)
|
||||
| ^^^^ - argument unexpected
|
||||
| ^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: associated function defined here
|
||||
--> $DIR/method-call-err-msg.rs:5:8
|
||||
|
@ -32,7 +32,7 @@ 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");
|
||||
| ^ ------- ------- argument unexpected
|
||||
| ^ ------- ------- argument of type `&'static str` unexpected
|
||||
| |
|
||||
| expected `isize`, found `&str`
|
||||
|
|
||||
|
@ -54,7 +54,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/issue-34264.rs:7:5
|
||||
|
|
||||
LL | foo(Some(42), 2, "");
|
||||
| ^^^ -- argument unexpected
|
||||
| ^^^ -- argument of type `&'static str` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/issue-34264.rs:1:4
|
||||
@ -84,7 +84,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/issue-34264.rs:10:5
|
||||
|
|
||||
LL | bar(1, 2, 3);
|
||||
| ^^^ - argument unexpected
|
||||
| ^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/issue-34264.rs:3:4
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/args-instead-of-tuple-errors.rs:6:34
|
||||
|
|
||||
LL | let _: Option<(i32, bool)> = Some(1, 2);
|
||||
| ^^^^ - - argument unexpected
|
||||
| ^^^^ - - argument of type `{integer}` unexpected
|
||||
| |
|
||||
| expected tuple, found integer
|
||||
|
|
||||
@ -22,7 +22,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/args-instead-of-tuple-errors.rs:8:5
|
||||
|
|
||||
LL | int_bool(1, 2);
|
||||
| ^^^^^^^^ - - argument unexpected
|
||||
| ^^^^^^^^ - - argument of type `{integer}` unexpected
|
||||
| |
|
||||
| expected tuple, found integer
|
||||
|
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/wrong_argument_ice-3.rs:9:16
|
||||
|
|
||||
LL | groups.push(new_group, vec![process]);
|
||||
| ^^^^ --------- ------------- argument unexpected
|
||||
| ^^^^ --------- ------------- argument of type `Vec<&Process>` unexpected
|
||||
| |
|
||||
| expected tuple, found struct `Vec`
|
||||
|
|
||||
|
@ -6,7 +6,7 @@ LL | (|| {})(|| {
|
||||
LL | |
|
||||
LL | | let b = 1;
|
||||
LL | | });
|
||||
| |_____- argument unexpected
|
||||
| |_____- argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 5:6]` unexpected
|
||||
|
|
||||
note: closure defined here
|
||||
--> $DIR/wrong_argument_ice-4.rs:2:6
|
||||
|
@ -11,7 +11,7 @@ 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);
|
||||
| ^^^^^^^^^^^^^^^^^^ -- argument unexpected
|
||||
| ^^^^^^^^^^^^^^^^^^ -- argument of type `{integer}` unexpected
|
||||
|
|
||||
note: associated function defined here
|
||||
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/remove-extra-argument.rs:6:5
|
||||
|
|
||||
LL | l(vec![], vec![])
|
||||
| ^ ------ argument unexpected
|
||||
| ^ ------ argument of type `Vec<_>` unexpected
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/remove-extra-argument.rs:3:4
|
||||
|
@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/struct-enum-wrong-args.rs:6:13
|
||||
|
|
||||
LL | let _ = Some(3, 2);
|
||||
| ^^^^ - argument unexpected
|
||||
| ^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: tuple variant defined here
|
||||
--> $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
|
||||
--> $DIR/struct-enum-wrong-args.rs:7:13
|
||||
|
|
||||
LL | let _ = Ok(3, 6, 2);
|
||||
| ^^ - - argument unexpected
|
||||
| ^^ - - argument of type `{integer}` unexpected
|
||||
| |
|
||||
| argument unexpected
|
||||
| argument of type `{integer}` unexpected
|
||||
|
|
||||
note: tuple variant defined here
|
||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||
@ -68,7 +68,7 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied
|
||||
--> $DIR/struct-enum-wrong-args.rs:10:13
|
||||
|
|
||||
LL | let _ = Wrapper(5, 2);
|
||||
| ^^^^^^^ - argument unexpected
|
||||
| ^^^^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: tuple struct defined here
|
||||
--> $DIR/struct-enum-wrong-args.rs:2:8
|
||||
@ -116,7 +116,7 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/struct-enum-wrong-args.rs:13:13
|
||||
|
|
||||
LL | let _ = DoubleWrapper(5, 2, 7);
|
||||
| ^^^^^^^^^^^^^ - argument unexpected
|
||||
| ^^^^^^^^^^^^^ - argument of type `{integer}` unexpected
|
||||
|
|
||||
note: tuple struct defined here
|
||||
--> $DIR/struct-enum-wrong-args.rs:3:8
|
||||
|
Loading…
Reference in New Issue
Block a user