本頁尚未翻譯,以下為英文原文。
#E0086: invalid union
A union declares at least one field, and its literal sets exactly one of them, with no ..base. Unions take only #[repr(C)].
nabi
#[repr(C)]
union Empty {}
error[E0086]: union `Empty` declares no fields --> main.nabi:2:1 | 2 | union Empty {} | ^^^^^
Declare at least one field. A union exists to match a C union, so it is #[repr(C)] and is read in unsafe code (chapter 14).
Related: E0094 invalid representation
Found a mistake? Edit this page on GitHub. Last updated