mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 23:33:00 +03:00
Fixed typo: changing an immutable ref will not compile
This commit is contained in:
parent
2359061733
commit
337710e13d
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user