本頁尚未翻譯,以下為英文原文。
#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.
Found a mistake? Edit this page on GitHub. Last updated