]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0184.md
Rollup merge of #72674 - Mark-Simulacrum:clippy-always-test-pass, r=oli-obk
[rust.git] / src / librustc_error_codes / error_codes / E0184.md
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.
19
20 [iss20126]: https://github.com/rust-lang/rust/issues/20126