Skip to content
Permalink
Browse files

Improve E0184 explanation

  • Loading branch information
GuillaumeGomez committed Jan 8, 2020
1 parent ee84c30 commit 326994dfe63ae8a892cdfadc107cd36c113f6bb1
Showing with 18 additions and 4 deletions.
  1. +18 −4 src/librustc_error_codes/error_codes/E0184.md
@@ -1,6 +1,20 @@
Explicitly implementing both Drop and Copy for a type is currently disallowed.
This feature can make some sense in theory, but the current implementation is
incorrect and can lead to memory unsafety (see [issue #20126][iss20126]), so
it has been disabled for now.
The `Copy` trait was implemented on a type with a `Drop` implementation.

Erroneous code example:

```compile_fail,E0184
#[derive(Copy)]
struct Foo; // error!
impl Drop for Foo {
fn drop(&mut self) {
}
}
```

Explicitly implementing both `Drop` and `Copy` trait on a type is currently
disallowed. This feature can make some sense in theory, but the current
implementation is incorrect and can lead to memory unsafety (see
[issue #20126][iss20126]), so it has been disabled for now.

[iss20126]: https://github.com/rust-lang/rust/issues/20126

0 comments on commit 326994d

Please sign in to comment.
You can’t perform that action at this time.