(This is a fork of issue #15714 from the github repository that was closed but could still be discussed usefully.)
Original issue text:
A key worry in a web browser is the size of data. We’d like to know that e.g. an enum with a single pointer constructor and 5 nullary constructors can still fit into a single machine word on 64-bit architectures. All of these optimizations need to work with custom smart pointer types, but we also need to be able to disable them for some smart pointers, e.g. pointers that are tracked by an external GC.
original feedback from strcat:
It’s not possible to do this because Rust allows taking references to the values inside an enum. It can’t use tagged pointers without breaking the language semantics.
Since this would be a language change rather than an optimization in the compiler, it needs to go through the RFC process. I really don’t know how it would fit into the enum system though. It would need to forbid using ref / ref mut for a variant.