rust/src/librustc/middle
Cameron Zwarich d7de4e9aff Enforce stronger guarantees for mutable borrows
Implement the stronger guarantees for mutable borrows from #12624. This
removes the ability to read from a mutably borrowed path for the
duration of the borrow, and enforces a unique access path for any
mutable borrow, for both reads and writes.

This makes mutable borrows work better with concurrent accesses from
multiple threads, and it opens the door for allowing moves out of
mutably borrowed values, as long as a new value is written before the
mutable borrow ends. This also aligns Rust more closely with academic
languages based on substructural types and separation logic.

The most common situation triggering an error after this change is a
call to a function mutably borrowing self with self.field as one of the
arguments. The workaround is to bind self.field to a temporary, but the
need for these temporaries will hopefully go away after #6268 is fixed.

Another situation that triggers an error is using the head expression of
a match in an arm that binds a variable with a mutable reference. The
use of the head expression needs to be replaced with an expression that
reconstructs it from match-bound variables.

This fixes #12624.

[breaking-change]
2014-06-13 20:48:09 -07:00
..
borrowck Enforce stronger guarantees for mutable borrows 2014-06-13 20:48:09 -07:00
cfg rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
save Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
trans librustc: Forbid transmute from being called on types whose size is 2014-06-13 13:53:55 -07:00
typeck librustc: Take in account mutability when casting array to raw ptr. 2014-06-13 13:53:35 -07:00
astencode.rs Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
check_const.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
check_loop.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
check_match.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
check_static.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
const_eval.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
dataflow.rs Fix all violations of stronger guarantees for mutable borrows 2014-06-13 20:48:09 -07:00
dead.rs Fix the unused struct field lint for struct variants 2014-06-13 13:53:34 -07:00
def.rs Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
dependency_format.rs
effect.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
entry.rs
expr_use_visitor.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
freevars.rs
graph.rs Fix more misspelled comments and strings. 2014-06-10 11:24:17 -04:00
intrinsicck.rs librustc: Forbid transmute from being called on types whose size is 2014-06-13 13:53:55 -07:00
kind.rs Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
lang_items.rs librustc: Implement overloading for the call operator behind a feature 2014-06-09 12:39:17 -07:00
lint.rs auto merge of #14831 : alexcrichton/rust/format-intl, r=brson 2014-06-13 14:42:03 +00:00
liveness.rs Fix all violations of stronger guarantees for mutable borrows 2014-06-13 20:48:09 -07:00
mem_categorization.rs std: Remove i18n/l10n from format! 2014-06-11 16:04:24 -07:00
pat_util.rs
privacy.rs Fix all violations of stronger guarantees for mutable borrows 2014-06-13 20:48:09 -07:00
reachable.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
region.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
resolve_lifetime.rs librustc: Fix the issue with labels shadowing variable names by making 2014-06-13 13:53:34 -07:00
resolve.rs Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
subst.rs Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
ty_fold.rs Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
ty.rs librustc: Forbid transmute from being called on types whose size is 2014-06-13 13:53:55 -07:00
weak_lang_items.rs