about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs8
-rw-r--r--tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr14
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs
new file mode 100644
index 00000000000..76b93c0c947
--- /dev/null
+++ b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.rs
@@ -0,0 +1,8 @@
+use std::rc::Rc;
+
+#[derive(PartialEq)] //~ NOTE in this expansion
+pub struct Function {
+    callback: Rc<dyn Fn()>, //~ ERROR binary operation `==` cannot be applied to type `Rc<dyn Fn()>`
+}
+
+fn main() {}
diff --git a/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
new file mode 100644
index 00000000000..40464a49c34
--- /dev/null
+++ b/tests/ui/deriving/do-not-suggest-calling-fn-in-derive-macro.stderr
@@ -0,0 +1,14 @@
+error[E0369]: binary operation `==` cannot be applied to type `Rc<dyn Fn()>`
+  --> $DIR/do-not-suggest-calling-fn-in-derive-macro.rs:5:5
+   |
+LL | #[derive(PartialEq)]
+   |          --------- in this derive macro expansion
+LL | pub struct Function {
+LL |     callback: Rc<dyn Fn()>,
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0369`.