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
In unsafe block, it is very easy to make a bunch of mistakes which rustc can't detect. A few examples from my head:
transmuting &T to *mut T or &mut T. Just like std::vec::IntoIter::as_mut_slice borrows &self, returns &mut of contents. rust#39465 showed, even experienced programmers may overlook this kind of errors. Glad to see the progress here: https://github.com/Manishearth/rust-clippy/pull/1528.
&T
*mut T
&mut T
std::vec::IntoIter::as_mut_slice
&self
&mut
types based on Unique<T> should not allow alias Example: LinkedList implementation violates aliasing rules rust#34417.
Unique<T>
types containing raw pointers probably need a PhantomData field
PhantomData
Raw pointers which are never assigned by null, could be wrapped in NonZero
NonZero
This list could be very long. These kind of issues are vital to memory safety.
My intent of this issue is to discuss what kind of checkers could be added into our backlist.
The text was updated successfully, but these errors were encountered:
@Manishearth If there is no informative discussion here, could you please help to close this issue?
I have a vague idea of this area, but the idea is not matured enough to form more constructive input.
Sorry, something went wrong.
No branches or pull requests
In unsafe block, it is very easy to make a bunch of mistakes which rustc can't detect.
A few examples from my head:
transmuting
&T
to*mut T
or&mut T
.Just like
std::vec::IntoIter::as_mut_slice
borrows&self
, returns&mut
of contents. rust#39465 showed, even experienced programmers may overlook this kind of errors. Glad to see the progress here: https://github.com/Manishearth/rust-clippy/pull/1528.types based on
Unique<T>
should not allow aliasExample: LinkedList implementation violates aliasing rules rust#34417.
types containing raw pointers probably need a
PhantomData
fieldRaw pointers which are never assigned by null, could be wrapped in
NonZero
This list could be very long. These kind of issues are vital to memory safety.
My intent of this issue is to discuss what kind of checkers could be added into our backlist.
The text was updated successfully, but these errors were encountered: