Closed
Description
Discussion topic about how enums are represented in Rust. Some things to work out:
- What are the
#[repr]
options available for enums? - When do we currently perform
Option<T>
-like layout optimizations? - When do we guarantee
Option<T>
-like layout optimizations?- For any Option-like enum? What about things like
Result<T, ()>
? - What are the conditions on T? (Obviously, must have some undefined values)
- the Rustonomicon has some text on this topic
- For any Option-like enum? What about things like
- Are there important enum variant optimizations we want freedom to do in the future that we might want to keep in mind?
- Size of empty enums and
!
: defined to be 0 - C-like enums: define, what does it say about representation?
- document the effect of
#[repr(C)
and friends here
- document the effect of