forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve duplicate derive Copy/Clone diagnostics
- Loading branch information
1 parent
360f7d7
commit 5bb72cc
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/ui/derives/duplicate-derive-copy-clone-diagnostics.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Duplicate implementations of Copy/Clone should not trigger | ||
// borrow check warnings | ||
// See #131083 | ||
|
||
#[derive(Copy, Clone)] | ||
#[derive(Copy, Clone)] | ||
//~^ ERROR conflicting implementations of trait `Copy` | ||
enum E {} | ||
|
||
fn main() {} |
23 changes: 23 additions & 0 deletions
23
tests/ui/derives/duplicate-derive-copy-clone-diagnostics.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
error[E0119]: conflicting implementations of trait `Copy` for type `E` | ||
--> $DIR/duplicate-derive-copy-clone-diagnostics.rs:2: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:2: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`. |