mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-24 16:10:25 +08:00
Merge pull request #203 from ykomatsu/text
Change the type of output messages
This commit is contained in:
commit
b7e4ce81bb
@ -580,7 +580,7 @@ fn change(some_string: &String) {
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error: cannot borrow immutable borrowed content `*some_string` as mutable
|
||||
--> error.rs:8:5
|
||||
|
|
||||
@ -622,7 +622,7 @@ let r2 = &mut s;
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error[E0499]: cannot borrow `s` as mutable more than once at a time
|
||||
--> borrow_twice.rs:5:19
|
||||
|
|
||||
@ -666,7 +666,7 @@ let r3 = &mut s; // BIG PROBLEM
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immutable
|
||||
--> borrow_thrice.rs:6:19
|
||||
|
|
||||
@ -707,7 +707,7 @@ fn dangle() -> &String {
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> dangle.rs:5:16
|
||||
|
|
||||
@ -725,7 +725,7 @@ This error message refers to a feature we haven’t learned about yet,
|
||||
‘lifetimes’. The message does contain the key to why this code is a problem,
|
||||
though:
|
||||
|
||||
```text
|
||||
```bash
|
||||
this function’s return type contains a borrowed value, but there is no value
|
||||
for it to be borrowed from
|
||||
```
|
||||
|
@ -106,7 +106,7 @@ fn change(some_string: &String) {
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error: cannot borrow immutable borrowed content `*some_string` as mutable
|
||||
--> error.rs:8:5
|
||||
|
|
||||
@ -148,7 +148,7 @@ let r2 = &mut s;
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error[E0499]: cannot borrow `s` as mutable more than once at a time
|
||||
--> borrow_twice.rs:5:19
|
||||
|
|
||||
@ -192,7 +192,7 @@ let r3 = &mut s; // BIG PROBLEM
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immutable
|
||||
--> borrow_thrice.rs:6:19
|
||||
|
|
||||
@ -233,7 +233,7 @@ fn dangle() -> &String {
|
||||
|
||||
Here’s the error:
|
||||
|
||||
```text
|
||||
```bash
|
||||
error[E0106]: missing lifetime specifier
|
||||
--> dangle.rs:5:16
|
||||
|
|
||||
@ -251,7 +251,7 @@ This error message refers to a feature we haven’t learned about yet,
|
||||
‘lifetimes’. The message does contain the key to why this code is a problem,
|
||||
though:
|
||||
|
||||
```text
|
||||
```bash
|
||||
this function’s return type contains a borrowed value, but there is no value
|
||||
for it to be borrowed from
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user