-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
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
&Tto*mut Tor&mut T.
Just likestd::vec::IntoIter::as_mut_sliceborrows&self, returns&mutof 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 alias
Example: LinkedList implementation violates aliasing rules rust#34417. -
types containing raw pointers probably need a
PhantomDatafield -
Raw 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.