diff options
| author | Michael Howell <michael@notriddle.com> | 2017-11-22 10:58:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-22 10:58:31 -0700 |
| commit | a0628ef3d1c97f27d0a20995e6b32d841b78cf52 (patch) | |
| tree | 0dabb439298b40b6be5b0daba834b6c367634650 /src | |
| parent | 8c9004630839888dd42595c9a481af1b7ae979bc (diff) | |
Update diagnostics.rs
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/diagnostics.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index cba1a66c17c..eca64bfb5ec 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -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 |
