diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-09 00:22:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-09 00:22:16 +0100 |
| commit | 91d5fbaeb14aa8c96e780398a7b6fc9b7f25262d (patch) | |
| tree | 86eb74ac72fefaa604e079e20cfbf61bde755c8d | |
| parent | 916a7d3a2c5bfd0278c7c729a620d8392a850fb8 (diff) | |
| parent | 326994dfe63ae8a892cdfadc107cd36c113f6bb1 (diff) | |
| download | rust-91d5fbaeb14aa8c96e780398a7b6fc9b7f25262d.tar.gz rust-91d5fbaeb14aa8c96e780398a7b6fc9b7f25262d.zip | |
Rollup merge of #68005 - GuillaumeGomez:explanation-e0184, r=Dylan-DPC
Improve E0184 explanation r? @Dylan-DPC
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0184.md | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/librustc_error_codes/error_codes/E0184.md b/src/librustc_error_codes/error_codes/E0184.md index e7fa8dfd831..4624f9e5b85 100644 --- a/src/librustc_error_codes/error_codes/E0184.md +++ b/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 |
