Open
Description
pub struct MutUnsafeSlice<'s>(&'s mut [u32]);
struct Foo {}
impl Foo {
pub unsafe fn foo(&self) -> &mut [u32] {
panic!()
}
pub unsafe fn foo1(&self) -> MutUnsafeSlice {
panic!()
}
}
fn main() {}
Should mut_from_ref
apply to unsafe functions as well?
It is trivial to work around that error by wrapping the mutable reference in a new struct.
Here is the refcell implementation that does something very similar.
I personally don't have any strong opinions in either direction. I just needed to implement something similar to RefCell (runtime borrowing) and I ran into this lint.
Metadata
Metadata
Assignees
Labels
No labels