-
Notifications
You must be signed in to change notification settings - Fork 2
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
OpaqueTypedefUnsized::from_* are unsound #1
Comments
Generally unsafe transmutes in the standard library are not safe to copy into your code. If the compiler ever makes a change that would break those transmutes, they would just fix the transmutes in the same release. Whereas in your code such a change would result in unsoundness. The Rocket example is undefined behavior. |
I understand. |
Fixed. |
https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1280-2018-08-02
🎉 |
This example from the readme may work on the current version of Rust on our current targets but is undefined behavior. The compiler is free to represent MyStr different from str and that would lead to memory unsafety. If you need this to be well-defined, your macro needs to check for a
#[repr(C)]
on the newtype struct and panic if there is not one, similar toref-cast
.The text was updated successfully, but these errors were encountered: