forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#131153 - VulnBandit:copy_impl_vuln, r=compiler-errors Improve duplicate derive Copy/Clone diagnostics Improve duplicate derive Copy/Clone diagnostics. Closes rust-lang#131083
- Loading branch information
Showing
3 changed files
with
51 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
11 changes: 11 additions & 0 deletions
11
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,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() {} |
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: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`. |