about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/issues/issue-62375.stderr7
-rw-r--r--tests/ui/typeck/derive-sugg-arg-arity.rs8
-rw-r--r--tests/ui/typeck/derive-sugg-arg-arity.stderr31
3 files changed, 44 insertions, 2 deletions
diff --git a/tests/ui/issues/issue-62375.stderr b/tests/ui/issues/issue-62375.stderr
index cd632e64fe5..f6d7968c0c4 100644
--- a/tests/ui/issues/issue-62375.stderr
+++ b/tests/ui/issues/issue-62375.stderr
@@ -11,8 +11,11 @@ note: an implementation of `PartialEq<fn(()) -> A {A::Value}>` might be missing
    |
 LL | enum A {
    | ^^^^^^ must implement `PartialEq<fn(()) -> A {A::Value}>`
-note: the trait `PartialEq` must be implemented
-  --> $SRC_DIR/core/src/cmp.rs:LL:COL
+help: consider annotating `A` with `#[derive(PartialEq)]`
+   |
+LL + #[derive(PartialEq)]
+LL | enum A {
+   |
 help: use parentheses to construct this tuple variant
    |
 LL |     a == A::Value(/* () */);
diff --git a/tests/ui/typeck/derive-sugg-arg-arity.rs b/tests/ui/typeck/derive-sugg-arg-arity.rs
new file mode 100644
index 00000000000..094c93a8535
--- /dev/null
+++ b/tests/ui/typeck/derive-sugg-arg-arity.rs
@@ -0,0 +1,8 @@
+pub struct A;
+
+fn main() {
+    match () {
+        _ => match A::partial_cmp() {},
+        //~^ ERROR the function or associated item `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied
+    }
+}
diff --git a/tests/ui/typeck/derive-sugg-arg-arity.stderr b/tests/ui/typeck/derive-sugg-arg-arity.stderr
new file mode 100644
index 00000000000..5b4c4817198
--- /dev/null
+++ b/tests/ui/typeck/derive-sugg-arg-arity.stderr
@@ -0,0 +1,31 @@
+error[E0599]: the function or associated item `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied
+  --> $DIR/derive-sugg-arg-arity.rs:5:23
+   |
+LL | pub struct A;
+   | ------------
+   | |
+   | function or associated item `partial_cmp` not found for this struct
+   | doesn't satisfy `A: Iterator`
+   | doesn't satisfy `A: PartialOrd<_>`
+...
+LL |         _ => match A::partial_cmp() {},
+   |                       ^^^^^^^^^^^ function or associated item cannot be called on `A` due to unsatisfied trait bounds
+   |
+   = note: the following trait bounds were not satisfied:
+           `A: PartialOrd<_>`
+           which is required by `&A: PartialOrd<&_>`
+           `A: PartialOrd<_>`
+           which is required by `&mut A: PartialOrd<&mut _>`
+           `A: Iterator`
+           which is required by `&mut A: Iterator`
+note: the trait `Iterator` must be implemented
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]`
+   |
+LL + #[derive(PartialEq, PartialOrd)]
+LL | pub struct A;
+   |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.