about summary refs log tree commit diff
path: root/tests/ui/str/str-array-assignment.stderr
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-04-18 19:44:27 +0000
committerMichael Goulet <michael@errs.io>2023-05-08 03:36:30 +0000
commita9051d861ca13a1c16da3cd4248b26d86cf5e1d5 (patch)
tree7fe6eb692e34d808afc4392d1ed73fab56ad0528 /tests/ui/str/str-array-assignment.stderr
parentad6b20bf5225c65aab30169c9a173719f5bdfc04 (diff)
downloadrust-a9051d861ca13a1c16da3cd4248b26d86cf5e1d5.tar.gz
rust-a9051d861ca13a1c16da3cd4248b26d86cf5e1d5.zip
Tweak borrow suggestion
Diffstat (limited to 'tests/ui/str/str-array-assignment.stderr')
-rw-r--r--tests/ui/str/str-array-assignment.stderr21
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/ui/str/str-array-assignment.stderr b/tests/ui/str/str-array-assignment.stderr
index c23400a1d14..515cb9e12f8 100644
--- a/tests/ui/str/str-array-assignment.stderr
+++ b/tests/ui/str/str-array-assignment.stderr
@@ -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