未验证 提交 a0628ef3 编写于 作者: M Michael Howell 提交者: GitHub

Update diagnostics.rs

上级 8c900463
......@@ -1641,13 +1641,13 @@ impl Foo {
These attributes do not work on typedefs, since typedefs are just aliases.
Representations like `#[repr(u8)]`, `#[repr(i64)]` are for selecting the
discriminant size for C-like enums (when there is no associated data, e.g.
discriminant size for enums with no data fields on any of the variants, e.g.
`enum Color {Red, Blue, Green}`), effectively setting the size of the enum to
the size of the provided type. Such an enum can be cast to a value of the same
type as well. In short, `#[repr(u8)]` makes the enum behave like an integer
with a constrained set of allowed values.
Only C-like enums can be cast to numerical primitives, so this attribute will
Only field-less enums can be cast to numerical primitives, so this attribute will
not apply to structs.
`#[repr(packed)]` reduces padding to make the struct size smaller. The
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册