1
Fork 0

Tweak borrow suggestion

This commit is contained in:
Michael Goulet 2023-04-18 19:44:27 +00:00
parent ad6b20bf52
commit a9051d861c
26 changed files with 288 additions and 211 deletions

View file

@ -10,10 +10,12 @@ error[E0308]: mismatched types
--> $DIR/str-array-assignment.rs:5:27
|
LL | let u: &str = if true { s[..2] } else { s };
| ^^^^^^
| |
| expected `&str`, found `str`
| help: consider borrowing here: `&s[..2]`
| ^^^^^^ expected `&str`, found `str`
|
help: consider borrowing here
|
LL | let u: &str = if true { &s[..2] } else { s };
| +
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/str-array-assignment.rs:7:7
@ -33,11 +35,14 @@ error[E0308]: mismatched types
--> $DIR/str-array-assignment.rs:9:17
|
LL | let w: &str = s[..2];
| ---- ^^^^^^
| | |
| | expected `&str`, found `str`
| | help: consider borrowing here: `&s[..2]`
| ---- ^^^^^^ expected `&str`, found `str`
| |
| expected due to this
|
help: consider borrowing here
|
LL | let w: &str = &s[..2];
| +
error: aborting due to 4 previous errors