This is very simple code about mutable borrow. code1 is compiled, but code2 is not compiled. difference of them is `let b` has explicit type-annotation or not. In this case, why is explicit annotation needed?
//code1 fn main(){ let a = &mut 10i; { let b:&mut int = a; *b = 11i; } println!("{}",a); } //code2 fn main(){ let a = &mut 10i; { let b = a; *b = 11i; } println!("{}",a); }
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev