File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -275,17 +275,21 @@ let mut a = &mut i;
275275// error: cannot borrow `i` as mutable more than once at a time
276276```
277277
278- Please note that in rust, you can have as many reference on a variable as you
279- want, but only one can be mutable. Example:
278+ Please note that in rust, you can either have many immutable references, or one
279+ mutable reference. Take a look at
280+ https://doc.rust-lang.org/stable/book/references-and-borrowing.html for more
281+ information. Example:
280282
281283
282284```
283285let mut i = 0;
284- let mut x = &mut i;
285- let mut a = &i;
286- let mut b = &i;
287- let mut c = &i;
288- // ...
286+ let mut x = &mut i; // ok!
287+
288+ // or:
289+ let mut i = 0;
290+ let a = &i; // ok!
291+ let b = &i; // still ok!
292+ let c = &i; // super still ok!
289293```
290294"## ,
291295
You can’t perform that action at this time.
0 commit comments