-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transmuting enums is UB #92
Comments
Looks like it gonna be fixed by #63 |
oh hey! thanks for your interest. We are very much interested in parsing the chip-to-chip message safely (#63 implements #20), but the struct-oriented |
Good to hear. I've used |
My main trouble is that operation in MsgType is currently parsed as-needed, thus not buying much logic-safety over variant-casting. I'll look on crates.io and your code for examples too. The good news is num-traits works just as you suggested, hooray! |
You can express lazy parsing with any kind of |
Looking at code I found that you are performing UB conversion from primitive to enum
anne-key/src/protocol.rs
Lines 10 to 35 in ac02810
You may argue "Hey, but there is an attribute", but in fact it doesn't work the way you expect and may produce panics in safe Rust:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=dd880f555dff38824b094dd8dec2f6f2
I'd better to be replaced with
num_derive
:The text was updated successfully, but these errors were encountered: