diff options
Diffstat (limited to 'src/docs/mut_from_ref.txt')
| -rw-r--r-- | src/docs/mut_from_ref.txt | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/docs/mut_from_ref.txt b/src/docs/mut_from_ref.txt deleted file mode 100644 index cc1da12549a..00000000000 --- a/src/docs/mut_from_ref.txt +++ /dev/null @@ -1,26 +0,0 @@ -### 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](https://github.com/rust-lang/rust/issues/39465) 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 { .. } -``` \ No newline at end of file |
