rust/tests/ui/str/str-array-assignment.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.5 KiB
Plaintext
Raw Normal View History

2020-01-05 00:17:46 +00:00
error[E0308]: `if` and `else` have incompatible types
--> $DIR/str-array-assignment.rs:3:37
|
2018-02-23 03:42:32 +03:00
LL | let t = if true { s[..2] } else { s };
| ------ ^ expected `str`, found `&str`
| |
| expected because of this
error[E0308]: mismatched types
2018-12-25 08:56:47 -07:00
--> $DIR/str-array-assignment.rs:5:27
|
2018-02-23 03:42:32 +03:00
LL | let u: &str = if true { s[..2] } else { s };
| ^^^^^^
| |
| expected `&str`, found `str`
| help: consider borrowing here: `&s[..2]`
2018-07-10 23:10:13 +02:00
error[E0277]: the size for values of type `str` cannot be known at compilation time
2018-12-25 08:56:47 -07:00
--> $DIR/str-array-assignment.rs:7:7
|
2018-02-23 03:42:32 +03:00
LL | let v = s[..2];
| ^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: all local variables must have a statically known size
2018-05-29 00:11:34 +09:00
= help: unsized locals are gated as an unstable feature
help: consider borrowing here
|
LL | let v = &s[..2];
| +
error[E0308]: mismatched types
2018-12-25 08:56:47 -07:00
--> $DIR/str-array-assignment.rs:9:17
|
2018-02-23 03:42:32 +03:00
LL | let w: &str = s[..2];
| ---- ^^^^^^
| | |
| | expected `&str`, found `str`
| | help: consider borrowing here: `&s[..2]`
| expected due to this
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0277, E0308.
2018-03-03 15:59:40 +01:00
For more information about an error, try `rustc --explain E0277`.