identifiers: Use from_raw / into_raw instead of transmute for opaque type conversion

This commit is contained in:
Jonas Platte 2021-06-12 11:46:16 +02:00
parent c5653c672d
commit 8a42c1e136
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -182,11 +182,11 @@ macro_rules! opaque_identifier {
}
pub(super) fn from_owned(s: Box<str>) -> Box<Self> {
unsafe { std::mem::transmute(s) }
unsafe { Box::from_raw(Box::into_raw(s) as _) }
}
fn into_owned(self: Box<Self>) -> Box<str> {
unsafe { std::mem::transmute(self) }
unsafe { Box::from_raw(Box::into_raw(self) as _) }
}
doc_concat! {