docs

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

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

#E0094: invalid representation

A #[repr(..)] or #[niche] does not fit the type: a packed struct that holds a collected reference, a union with a repr other than C, or #[niche] on a type with more than one field. Change the attribute or the type.

nabi
#[niche]
struct Pair { a: i32; b: i32; }
error[E0094]: `#[niche]` goes on a single-field struct, not a struct with 2 fields
  --> main.nabi:1:1
   |
 1 | #[niche]
   | ^^

Put #[niche] on a struct with exactly one field, or remove it. A #[repr(packed)] struct holds C data only, not str, collections or closures.

Related: E0086 invalid union, E0083 invalid enum value

Found a mistake? Edit this page on GitHub. Last updated