Closed
Description
In latest rust HEAD there is a lint for casting immutable pointers to mutable ones, which is undefined behaviour. This is hit by eventual
:
src/core.rs:736:43: 736:57 error: mutating transmuted &mut T from &T may cause undefined behavior,consider instead using an UnsafeCell, #[deny(mutable_transmutes)] on by default
src/core.rs:736 let s: &mut CoreInner<T, E> = mem::transmute(self);
^~~~~~~~~~~~~~
src/core.rs:743:43: 743:57 error: mutating transmuted &mut T from &T may cause undefined behavior,consider instead using an UnsafeCell, #[deny(mutable_transmutes)] on by default
src/core.rs:743 let s: &mut CoreInner<T, E> = mem::transmute(self);
^~~~~~~~~~~~~~
src/core.rs:750:43: 750:57 error: mutating transmuted &mut T from &T may cause undefined behavior,consider instead using an UnsafeCell, #[deny(mutable_transmutes)] on by default
src/core.rs:750 let s: &mut CoreInner<T, E> = mem::transmute(self);
^~~~~~~~~~~~~~
src/core.rs:757:43: 757:57 error: mutating transmuted &mut T from &T may cause undefined behavior,consider instead using an UnsafeCell, #[deny(mutable_transmutes)] on by default
src/core.rs:757 let s: &mut CoreInner<T, E> = mem::transmute(self);
It is possible to fix this by having the offending functions take &mut self
(and then propagating this to every function that calls them) which allows the library to compile. I didn't really look at how this affects users of the library; my only use is in rust-bitcoin
which does not even compile on its own right now.
Metadata
Metadata
Assignees
Labels
No labels