rust/src/test/ui/suggestions/str-array-assignment.stderr

49 lines
1.5 KiB
Plaintext
Raw Normal View History

error[E0308]: if and else have incompatible types
--> $DIR/str-array-assignment.rs:13:11
|
2018-02-23 00:42:32 +00:00
LL | let t = if true { s[..2] } else { s };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str
|
= note: expected type `str`
found type `&str`
error[E0308]: mismatched types
--> $DIR/str-array-assignment.rs:15:27
|
2018-02-23 00:42:32 +00:00
LL | fn main() {
| - expected `()` because of default return type
...
2018-02-23 00:42:32 +00:00
LL | let u: &str = if true { s[..2] } else { s };
| ^^^^^^ expected &str, found str
|
= note: expected type `&str`
found type `str`
error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
--> $DIR/str-array-assignment.rs:17:7
|
2018-02-23 00:42:32 +00:00
LL | let v = s[..2];
| ^ ------ help: consider borrowing here: `&s[..2]`
| |
| `str` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: all local variables must have a statically known size
error[E0308]: mismatched types
--> $DIR/str-array-assignment.rs:19:17
|
2018-02-23 00:42:32 +00:00
LL | let w: &str = s[..2];
| ^^^^^^
| |
| expected &str, found str
| help: consider borrowing here: `&s[..2]`
|
= note: expected type `&str`
found type `str`
error: aborting due to 4 previous errors
2018-02-19 20:40:25 +00:00
You've got a few errors: E0277, E0308
If you want more information on an error, try using "rustc --explain E0277"