W3cubDocs

/Rust

Error code E0740

A union was declared with fields with destructors.

Erroneous code example:

#![allow(unused)]
fn main() {
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.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/error_codes/E0740.html