by nmilo · 4y ago · 0 comments
The concerns of undefined behavior, data races, use-after-free, etc. seem a lot less consequential in test code.
unsafe { transmute::<u32, Error>(error_code) }
than it is to verify that the weird macro code in the article is correct. There is no data races, use-after-free, etc. in that block, it does exactly what the article needs. To me, Rust programmers seem to have a weird notion that just the word "unsafe" is enough to conjure demons and monsters into otherwise totally normal code.