summaryrefslogtreecommitdiffstats
path: root/tests/ui/argument-suggestions
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/argument-suggestions/issue-109425.fixed20
-rw-r--r--tests/ui/argument-suggestions/issue-109425.rs20
-rw-r--r--tests/ui/argument-suggestions/issue-109425.stderr98
-rw-r--r--tests/ui/argument-suggestions/issue-109831.rs9
-rw-r--r--tests/ui/argument-suggestions/issue-109831.stderr51
5 files changed, 198 insertions, 0 deletions
diff --git a/tests/ui/argument-suggestions/issue-109425.fixed b/tests/ui/argument-suggestions/issue-109425.fixed
new file mode 100644
index 000000000..143ddf995
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109425.fixed
@@ -0,0 +1,20 @@
+// run-rustfix
+
+fn f() {}
+fn i(_: u32) {}
+fn is(_: u32, _: &str) {}
+fn s(_: &str) {}
+
+fn main() {
+ // code expected suggestion
+ f(); // f()
+ //~^ error: this function takes 0 arguments but 2 arguments were supplied
+ i(0,); // i(0,)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ i(0); // i(0)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ is(0, ""); // is(0, "")
+ //~^ error: this function takes 2 arguments but 4 arguments were supplied
+ s(""); // s("")
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+}
diff --git a/tests/ui/argument-suggestions/issue-109425.rs b/tests/ui/argument-suggestions/issue-109425.rs
new file mode 100644
index 000000000..a845c4195
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109425.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+
+fn f() {}
+fn i(_: u32) {}
+fn is(_: u32, _: &str) {}
+fn s(_: &str) {}
+
+fn main() {
+ // code expected suggestion
+ f(0, 1,); // f()
+ //~^ error: this function takes 0 arguments but 2 arguments were supplied
+ i(0, 1, 2,); // i(0,)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ i(0, 1, 2); // i(0)
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+ is(0, 1, 2, ""); // is(0, "")
+ //~^ error: this function takes 2 arguments but 4 arguments were supplied
+ s(0, 1, ""); // s("")
+ //~^ error: this function takes 1 argument but 3 arguments were supplied
+}
diff --git a/tests/ui/argument-suggestions/issue-109425.stderr b/tests/ui/argument-suggestions/issue-109425.stderr
new file mode 100644
index 000000000..1514f1cb4
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109425.stderr
@@ -0,0 +1,98 @@
+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 of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:3:4
+ |
+LL | fn f() {}
+ | ^
+help: remove the extra arguments
+ |
+LL - f(0, 1,); // f()
+LL + f(); // f()
+ |
+
+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 of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:4:4
+ |
+LL | fn i(_: u32) {}
+ | ^ ------
+help: remove the extra arguments
+ |
+LL - i(0, 1, 2,); // i(0,)
+LL + i(0,); // i(0,)
+ |
+
+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 of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:4:4
+ |
+LL | fn i(_: u32) {}
+ | ^ ------
+help: remove the extra arguments
+ |
+LL - i(0, 1, 2); // i(0)
+LL + i(0); // i(0)
+ |
+
+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 of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:5:4
+ |
+LL | fn is(_: u32, _: &str) {}
+ | ^^ ------ -------
+help: remove the extra arguments
+ |
+LL - is(0, 1, 2, ""); // is(0, "")
+LL + is(0, ""); // is(0, "")
+ |
+
+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 of type `{integer}`
+ |
+note: function defined here
+ --> $DIR/issue-109425.rs:6:4
+ |
+LL | fn s(_: &str) {}
+ | ^ -------
+help: remove the extra arguments
+ |
+LL - s(0, 1, ""); // s("")
+LL + s(""); // s("")
+ |
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/argument-suggestions/issue-109831.rs b/tests/ui/argument-suggestions/issue-109831.rs
new file mode 100644
index 000000000..2e8ae40f6
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109831.rs
@@ -0,0 +1,9 @@
+struct A;
+struct B;
+
+fn f(b1: B, b2: B, a2: C) {} //~ ERROR E0412
+
+fn main() {
+ f(A, A, B, C); //~ ERROR E0425
+ //~^ ERROR E0061
+}
diff --git a/tests/ui/argument-suggestions/issue-109831.stderr b/tests/ui/argument-suggestions/issue-109831.stderr
new file mode 100644
index 000000000..7b9a3c9ef
--- /dev/null
+++ b/tests/ui/argument-suggestions/issue-109831.stderr
@@ -0,0 +1,51 @@
+error[E0412]: cannot find type `C` in this scope
+ --> $DIR/issue-109831.rs:4:24
+ |
+LL | struct A;
+ | --------- similarly named struct `A` defined here
+...
+LL | fn f(b1: B, b2: B, a2: C) {}
+ | ^
+ |
+help: a struct with a similar name exists
+ |
+LL | fn f(b1: B, b2: B, a2: A) {}
+ | ~
+help: you might be missing a type parameter
+ |
+LL | fn f<C>(b1: B, b2: B, a2: C) {}
+ | +++
+
+error[E0425]: cannot find value `C` in this scope
+ --> $DIR/issue-109831.rs:7:16
+ |
+LL | struct A;
+ | --------- similarly named unit struct `A` defined here
+...
+LL | f(A, A, B, C);
+ | ^ help: a unit struct with a similar name exists: `A`
+
+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
+ | | |
+ | | expected `B`, found `A`
+ | expected `B`, found `A`
+ |
+note: function defined here
+ --> $DIR/issue-109831.rs:4:4
+ |
+LL | fn f(b1: B, b2: B, a2: C) {}
+ | ^ ----- ----- -----
+help: remove the extra argument
+ |
+LL - f(A, A, B, C);
+LL + f(/* B */, /* B */, B);
+ |
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0061, E0412, E0425.
+For more information about an error, try `rustc --explain E0061`.