summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0740.md
blob: 6240099a99f671b1e6934615e4a353908d2669f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
A `union` was declared with fields with destructors.

Erroneous code example:

```compile_fail,E0740
union Test {
    a: A, // error!
}

#[derive(Debug)]
struct A(i32);

impl Drop for A {
    fn drop(&mut self) { println!("A"); }
}
```

A `union` cannot have fields with destructors.