File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
compiler/rustc_error_codes/src/error_codes Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,11 @@ of the enum to the size of the provided type. Such an enum can be cast to a
3131value of the same type as well. In short, ` #[repr(u8)] ` makes a field-less enum
3232behave like an integer with a constrained set of allowed values.
3333
34- Only field-less enums can be cast to numerical primitives. This attribute
35- will not apply to structs.
34+ For a description of how ` #[repr(C)] ` and representations like ` #[repr(u8)] `
35+ affect the layout of enums with data fields, see [ RFC 2915] [ rfc2915 ] .
36+
37+ Only field-less enums can be cast to numerical primitives. Representations like
38+ ` #[repr(u8)] ` will not apply to structs.
3639
3740` #[repr(packed)] ` reduces padding to make the struct size smaller. The
3841representation of enums isn't strictly defined in Rust, and this attribute
@@ -42,3 +45,5 @@ won't work on enums.
4245types (i.e., ` u8 ` , ` i32 ` , etc) a representation that permits vectorization via
4346SIMD. This doesn't make much sense for enums since they don't consist of a
4447single list of data.
48+
49+ [ rfc2915 ] : https://github.com/rust-lang/rfcs/blob/master/text/2195-really-tagged-unions.md
You can’t perform that action at this time.
0 commit comments