docs

您正在閱讀 v0.1.2 的文件。Nabi 0.1.2 已停止支援。 最新版本:v0.1.3 →

本頁尚未翻譯,以下為英文原文。

#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