We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#[repr(C)]
RelativePath
I heard that the code such as below is unsound (lead to undefined behaviour):
relative-path/src/lib.rs
Lines 271 to 280 in 49d76f3
RelativePath type should have #[repr(C)] (stable) or #[repr(transparent)] (unstable) to be safe.
#[repr(transparent)]
This is because Rust doesn't guarantee that str and RelativePath have the same internal representations (and it will be guaranteed by #[repr(C)]).
str
For detail:
The text was updated successfully, but these errors were encountered:
Also: rust-lang/rust#45910
Yeah, I'm keeping an eye on the stabilization for #[repr(transparent)] for this. I guess we could consider using #[repr(C)] until then.
Sorry, something went wrong.
🎉 #[repr(transparent)] is now in stable (1.28)!
Fixed in 20d222a
No branches or pull requests
I heard that the code such as below is unsound (lead to undefined behaviour):
relative-path/src/lib.rs
Lines 271 to 280 in 49d76f3
RelativePath
type should have#[repr(C)]
(stable) or#[repr(transparent)]
(unstable) to be safe.This is because Rust doesn't guarantee that
str
andRelativePath
have the same internal representations (and it will be guaranteed by#[repr(C)]
).For detail:
The text was updated successfully, but these errors were encountered: