diff --git a/crates/ruma-identifiers/src/server_name.rs b/crates/ruma-identifiers/src/server_name.rs index 8f25e708..74110d98 100644 --- a/crates/ruma-identifiers/src/server_name.rs +++ b/crates/ruma-identifiers/src/server_name.rs @@ -19,11 +19,11 @@ impl ServerName { } fn from_owned(s: Box) -> Box { - unsafe { mem::transmute(s) } + unsafe { Box::from_raw(Box::into_raw(s) as _) } } fn into_owned(self: Box) -> Box { - unsafe { mem::transmute(self) } + unsafe { Box::from_raw(Box::into_raw(self) as _) } } /// Creates a string slice from this `ServerName`.