]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0740.md
Merge commit '9e3cd88718cd1912a515d26dbd9c4019fd5a9577' into clippyup
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0740.md
1 A `union` was declared with fields with destructors.
2
3 Erroneous code example:
4
5 ```compile_fail,E0740
6 union Test {
7     a: A, // error!
8 }
9
10 #[derive(Debug)]
11 struct A(i32);
12
13 impl Drop for A {
14     fn drop(&mut self) { println!("A"); }
15 }
16 ```
17
18 A `union` cannot have fields with destructors.