Skip to content

Commit 7badafa

Browse files
Add url to rust-book
1 parent bc72f54 commit 7badafa

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/librustc_borrowck/diagnostics.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff 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
```
283285
let 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

0 commit comments

Comments
 (0)