You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a decent amount of unsafe code involving ref-cast, which, if eliminated, would help make some crates be fully safe.
We could use the ref-cast crate, but it seems like a heavy dependency (involving syn) to replace just one transmute call.
#5101 was my first attempt at making macro_rules for this. My recollection is that one of the main issues with that approach was that it didn't eliminate the unsafe, it just shifted it around. Would moving that code to a separate crate be a viable option?
Another approach I was thinking was to check the fields by their type, as shown here.
Previous attempt: #5101
Also see: #6915
We have a decent amount of unsafe code involving ref-cast, which, if eliminated, would help make some crates be fully safe.
We could use the ref-cast crate, but it seems like a heavy dependency (involving
syn) to replace just onetransmutecall.#5101 was my first attempt at making
macro_rulesfor this. My recollection is that one of the main issues with that approach was that it didn't eliminate the unsafe, it just shifted it around. Would moving that code to a separate crate be a viable option?Another approach I was thinking was to check the fields by their type, as shown here.
What do we think about what to do here?
transmuteand allow such call sites as in Advertise that zerotrie uses safe Rust #6915ref-castand accept the extra costref-castwhen the feature is enabled andtransmutewhen the feature is not enabled@Manishearth