-
Notifications
You must be signed in to change notification settings - Fork 263
Remove some unsafe code; fix a soundness hole #721
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
base: master
Are you sure you want to change the base?
Conversation
c46b513
to
745b847
Compare
Adding a dependency on That might be fine! But it is something that will need to be considered. |
Cargo.toml
Outdated
@@ -28,6 +28,7 @@ exclude = [ | |||
[dependencies] | |||
cfg-if = "1.0" | |||
rustc-demangle = "0.1.24" | |||
zerocopy = { version = "0.8.26", features = ["derive"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this won't work. The standard library can't depend on proc-macros without completely breaking cross-compilation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given #720 (comment), I'll need to go back to the drawing board on this anyway. I'll see how much of this I can salvage without relying on derives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the definitions are auto-generated, it is still possible to add an impl
block outside of that file. It's all crate-local anyway. I dunno if that helps you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wouldn't really help with the safety - the point of the derives is the analysis they perform which validates that certain safety properties hold. While it would technically work to write the impls by hand, it wouldn't improve the safety situation.
Replace a number of lines of unsafe code with safe equivalents, some using `zerocopy`. In one instance, fix a soundness hole (rust-lang#720). Closes rust-lang#720
Okay, I've removed all uses of derives to address #721 (comment) and #720 (comment). |
Replace a number of lines of unsafe code with safe equivalents, some using
zerocopy
. In one instance, fix a soundness hole (#720).Closes #720