]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0184.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / 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