rust/src/libstd/io
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
..
net auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakis 2014-04-23 12:01:53 -07:00
buffered.rs Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
comm_adapters.rs Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
extensions.rs std: Make ~[T] no longer a growable vector 2014-04-18 10:06:24 -07:00
flate.rs Remove eof() from io::Reader 2014-01-09 09:27:10 -08:00
fs.rs Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
mem.rs Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
mod.rs std: Add an experimental connect_timeout function 2014-04-19 00:47:14 -07:00
pipe.rs Use new attribute syntax in python files in src/etc too (#13478) 2014-04-14 21:00:31 +05:30
process.rs Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
result.rs De-~[] Mem{Reader,Writer} 2014-04-06 15:40:01 -07:00
signal.rs std: Make ~[T] no longer a growable vector 2014-04-18 10:06:24 -07:00
stdio.rs Fixed Win64 build 2014-04-22 18:08:06 -07:00
tempfile.rs std: Switch field privacy as necessary 2014-03-31 15:17:12 -07:00
test.rs rustc: Don't allow priv use to shadow pub use 2014-04-10 15:22:01 -07:00
timer.rs std: Make std::comm return types consistent 2014-04-10 21:41:19 -07:00
util.rs De-~[] IO utils 2014-04-06 15:40:01 -07:00