@@ -8,21 +8,21 @@ error[E0308]: if and else have incompatible types
8
8
found type `&str`
9
9
10
10
error[E0308]: mismatched types
11
- --> $DIR/str-array-assignment.rs:14 :27
11
+ --> $DIR/str-array-assignment.rs:17 :27
12
12
|
13
- 11 | fn main() {
13
+ 11 | fn main() { //~ NOTE expected `()` because of default return type
14
14
| - expected `()` because of default return type
15
15
...
16
- 14 | let u: &str = if true { s[..2] } else { s };
16
+ 17 | let u: &str = if true { s[..2] } else { s };
17
17
| ^^^^^^ expected &str, found str
18
18
|
19
19
= note: expected type `&str`
20
20
found type `str`
21
21
22
22
error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
23
- --> $DIR/str-array-assignment.rs:15 :7
23
+ --> $DIR/str-array-assignment.rs:21 :7
24
24
|
25
- 15 | let v = s[..2];
25
+ 21 | let v = s[..2];
26
26
| ^ ------ help: consider a slice instead: `&s[..2]`
27
27
| |
28
28
| `str` does not have a constant size known at compile-time
@@ -31,9 +31,9 @@ error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
31
31
= note: all local variables must have a statically known size
32
32
33
33
error[E0308]: mismatched types
34
- --> $DIR/str-array-assignment.rs:16 :17
34
+ --> $DIR/str-array-assignment.rs:27 :17
35
35
|
36
- 16 | let w: &str = s[..2];
36
+ 27 | let w: &str = s[..2];
37
37
| ^^^^^^ expected &str, found str
38
38
|
39
39
= note: expected type `&str`
0 commit comments