Fixed typo: changing an immutable ref will not compile

This commit is contained in:
Jingwen 2015-06-13 17:27:05 +08:00
parent 2359061733
commit 337710e13d

View File

@ -281,7 +281,7 @@ fn main() {
println!("{}", var); // Unlike `box`, `var` can still be used
println!("{}", *ref_var);
// var = 5; // this would not compile because `var` is borrowed
// *ref_var = 6; // this would too, because `ref_var` is an immutable reference
// *ref_var = 6; // this would not too, because `ref_var` is an immutable reference
// Mutable reference
// While a value is mutably borrowed, it cannot be accessed at all.