Skip to content

Commit 326994d

Browse files
Improve E0184 explanation
1 parent ee84c30 commit 326994d

File tree

1 file changed

+18
-4
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+18
-4
lines changed
+18-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
Explicitly implementing both Drop and Copy for a type is currently disallowed.
2-
This feature can make some sense in theory, but the current implementation is
3-
incorrect and can lead to memory unsafety (see [issue #20126][iss20126]), so
4-
it has been disabled for now.
1+
The `Copy` trait was implemented on a type with a `Drop` implementation.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0184
6+
#[derive(Copy)]
7+
struct Foo; // error!
8+
9+
impl Drop for Foo {
10+
fn drop(&mut self) {
11+
}
12+
}
13+
```
14+
15+
Explicitly implementing both `Drop` and `Copy` trait on a type is currently
16+
disallowed. This feature can make some sense in theory, but the current
17+
implementation is incorrect and can lead to memory unsafety (see
18+
[issue #20126][iss20126]), so it has been disabled for now.
519

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

0 commit comments

Comments
 (0)