RS.CLIPPY.MUT_FROM_REF
Fns that create mutable refs from immutable ref args
What it does
This lint checks for functions that take immutable references and return mutable ones. This will not trigger if no unsafe code exists as there are multiple safe functions which will do this transformation
To be on the conservative side, if there's at least one mutable reference with the output lifetime, this lint will not trigger.
Why is this bad?
Creating a mutable reference which can be repeatably derived from an immutable reference is unsound as it allows creating multiple live mutable references to the same object.
This error actually lead to an interim Rust release 1.15.1.
Known problems
This pattern is used by memory allocators to allow allocating multiple objects while returning mutable references to each one. So long as different mutable references are returned each time such a function may be safe.
Example
fn foo(&Foo) -> &mut Bar { .. }