about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs11
-rw-r--r--tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr23
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs
new file mode 100644
index 00000000000..c4fb620fea4
--- /dev/null
+++ b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs
@@ -0,0 +1,11 @@
+// Duplicate implementations of Copy/Clone should not trigger
+// borrow check warnings
+// See #131083
+
+#[derive(Copy, Clone)]
+#[derive(Copy, Clone)]
+//~^ ERROR conflicting implementations of trait `Clone` for type `E`
+//~| ERROR conflicting implementations of trait `Copy` for type `E`
+enum E {}
+
+fn main() {}
diff --git a/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
new file mode 100644
index 00000000000..f8e1db33f53
--- /dev/null
+++ b/tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
@@ -0,0 +1,23 @@
+error[E0119]: conflicting implementations of trait `Copy` for type `E`
+  --> $DIR/duplicate-derive-copy-clone-diagnostics.rs:6:10
+   |
+LL | #[derive(Copy, Clone)]
+   |          ---- first implementation here
+LL | #[derive(Copy, Clone)]
+   |          ^^^^ conflicting implementation for `E`
+   |
+   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `Clone` for type `E`
+  --> $DIR/duplicate-derive-copy-clone-diagnostics.rs:6:16
+   |
+LL | #[derive(Copy, Clone)]
+   |                ----- first implementation here
+LL | #[derive(Copy, Clone)]
+   |                ^^^^^ conflicting implementation for `E`
+   |
+   = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0119`.