rust/src/librustc/middle
bors 6beb376b5c auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakis
This alters the borrow checker's requirements on invoking closures from
requiring an immutable borrow to requiring a unique immutable borrow. This means 
that it is illegal to invoke a closure through a `&` pointer because there is no 
guarantee that is not aliased. This does not mean that a closure is required to
be in a mutable location, but rather a location which can be proven to be
unique (often through a mutable pointer).
                                                                                 
For example, the following code is unsound and is no longer allowed:             
                                                                                 
    type Fn<'a> = ||:'a;                                                         
                                                                                 
    fn call(f: |Fn|) {                                                           
        f(|| {                                                                   
            f(|| {})                                                             
        });                                                                      
    }                                                                            
                                                                                 
    fn main() {                                                                  
        call(|a| {                                                               
            a();                                                                 
        });                                                                      
    }                                                                            
                                                                                 
There is no replacement for this pattern. For all closures which are stored in
structures, it was previously allowed to invoke the closure through `&self` but
it now requires invocation through `&mut self`.

The standard library has a good number of violations of this new rule, but the
fixes will be separated into multiple breaking change commits.
                                                                                 
Closes #12224
2014-04-23 12:01:53 -07:00
..
borrowck rustc: Tweak the borrow on closure invocations 2014-04-23 10:03:43 -07:00
cfg
trans auto merge of #13693 : thestinger/rust/mem, r=alexcrichton 2014-04-23 04:36:32 -07:00
typeck auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakis 2014-04-23 12:01:53 -07:00
astencode.rs rustc: de-@ metadata::cstore. 2014-04-22 19:06:54 +03:00
check_const.rs rustc: de-@ some RefCell's. 2014-04-22 19:06:43 +03:00
check_loop.rs
check_match.rs rustc: de-@ some RefCell's. 2014-04-22 19:06:43 +03:00
check_static.rs Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
const_eval.rs rustc: de-@ some RefCell's. 2014-04-22 19:06:43 +03:00
dataflow.rs rustc: move the method and vtable maps into ty::ctxt. 2014-04-22 17:18:20 +03:00
dead.rs rustc: remove ty::Impl. 2014-04-22 19:14:52 +03:00
effect.rs rustc: move the method and vtable maps into ty::ctxt. 2014-04-22 17:18:20 +03:00
entry.rs
freevars.rs rustc: de-@ freevars. 2014-04-22 19:06:52 +03:00
graph.rs
kind.rs rustc: de-@ middle::ty. 2014-04-22 19:20:12 +03:00
lang_items.rs rustc: de-@ lang_items. 2014-04-22 17:18:21 +03:00
lint.rs Fix other bugs with new closure borrowing 2014-04-23 10:03:43 -07:00
liveness.rs rustc: de-@ some RefCell's. 2014-04-22 19:06:43 +03:00
mem_categorization.rs rustc: de-@ mem_categorization. 2014-04-22 19:06:54 +03:00
moves.rs rustc: de-@ freevars. 2014-04-22 19:06:52 +03:00
pat_util.rs rustc: de-@ some RefCell's. 2014-04-22 19:06:43 +03:00
privacy.rs auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakis 2014-04-23 12:01:53 -07:00
reachable.rs rustc: move the method and vtable maps into ty::ctxt. 2014-04-22 17:18:20 +03:00
region.rs Fix misspellings in comments. 2014-04-21 00:49:39 -04:00
resolve_lifetime.rs Support unsized types with the type keyword 2014-04-23 12:30:58 +12:00
resolve.rs auto merge of #13398 : nick29581/rust/unsized-enum, r=nikomatsakis 2014-04-22 20:51:31 -07:00
subst.rs Fix misspellings in comments. 2014-04-21 00:49:39 -04:00
ty_fold.rs Refactor ty_vec represent &[T] as &([T]) 2014-04-20 12:41:53 +12:00
ty.rs auto merge of #13398 : nick29581/rust/unsized-enum, r=nikomatsakis 2014-04-22 20:51:31 -07:00