1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-07-31 20:10:49 +02:00

Merge pull request #1138 from jin/patch-1

Fixed typo: changing an immutable ref will not compile
This commit is contained in:
Adam Bard
2015-09-25 06:36:17 +08:00

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.