News for hackers. Stuff that matters.
Re:Switching from C++ to Rust by zabzonk on Monday March 13, 2023 @09:33PM (#35146116)
> Pretend we have the following sum type:

which looks remarkably like a union to me, if i understand your made-up language.

Re:Switching from C++ to Rust by cdcarter on Monday March 13, 2023 @10:56PM (#35146806)
It's not a union, though, it stores references to three memory locations, not just one (as a union represents a single memory location which can have multiple possible interpretations). And the lowered code has nothing protecting it from an invariant where more than one reference is non-null!