about summary refs log tree commit diff
path: root/tests/ui/argument-suggestions
diff options
context:
space:
mode:
authorMu42 <mu001999@outlook.com>2023-04-02 10:48:01 +0800
committerMu42 <mu001999@outlook.com>2023-04-02 10:48:01 +0800
commitbbfbecd59ff99b51d1ccf7764641ef32209b9dad (patch)
tree5df94f84945e70d7f4218e37d67eac8bd6ceb2c1 /tests/ui/argument-suggestions
parent0f6312f643aa1a8713e203a9ce2307f8b622b226 (diff)
downloadrust-bbfbecd59ff99b51d1ccf7764641ef32209b9dad.tar.gz
rust-bbfbecd59ff99b51d1ccf7764641ef32209b9dad.zip
Do not repeat idx
Diffstat (limited to 'tests/ui/argument-suggestions')
-rw-r--r--tests/ui/argument-suggestions/109831.rs9
-rw-r--r--tests/ui/argument-suggestions/109831.stderr51
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/ui/argument-suggestions/109831.rs b/tests/ui/argument-suggestions/109831.rs
new file mode 100644
index 00000000000..2e8ae40f630
--- /dev/null
+++ b/tests/ui/argument-suggestions/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/109831.stderr b/tests/ui/argument-suggestions/109831.stderr
new file mode 100644
index 00000000000..861f6d67baf
--- /dev/null
+++ b/tests/ui/argument-suggestions/109831.stderr
@@ -0,0 +1,51 @@
+error[E0412]: cannot find type `C` in this scope
+  --> $DIR/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/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/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/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`.