2017-11-24 22:47:40 +00:00
|
|
|
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 };
|
2017-11-24 22:47:40 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str
|
|
|
|
|
|
|
|
|
= note: expected type `str`
|
|
|
|
found type `&str`
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2017-12-10 20:29:24 +00:00
|
|
|
--> $DIR/str-array-assignment.rs:15:27
|
2017-11-24 22:47:40 +00:00
|
|
|
|
|
2018-02-23 00:42:32 +00:00
|
|
|
LL | fn main() {
|
2017-11-24 22:47:40 +00:00
|
|
|
| - expected `()` because of default return type
|
|
|
|
...
|
2018-02-23 00:42:32 +00:00
|
|
|
LL | let u: &str = if true { s[..2] } else { s };
|
2017-11-24 22:47:40 +00:00
|
|
|
| ^^^^^^ expected &str, found str
|
|
|
|
|
|
|
|
|
= note: expected type `&str`
|
|
|
|
found type `str`
|
|
|
|
|
|
|
|
error[E0277]: the trait bound `str: std::marker::Sized` is not satisfied
|
2017-12-10 20:29:24 +00:00
|
|
|
--> $DIR/str-array-assignment.rs:17:7
|
2017-11-24 22:47:40 +00:00
|
|
|
|
|
2018-02-23 00:42:32 +00:00
|
|
|
LL | let v = s[..2];
|
2017-11-26 20:52:00 +00:00
|
|
|
| ^ ------ help: consider borrowing here: `&s[..2]`
|
2017-11-24 22:47:40 +00:00
|
|
|
| |
|
|
|
|
| `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
|
2017-12-10 20:29:24 +00:00
|
|
|
--> $DIR/str-array-assignment.rs:19:17
|
2017-11-24 22:47:40 +00:00
|
|
|
|
|
2018-02-23 00:42:32 +00:00
|
|
|
LL | let w: &str = s[..2];
|
2017-11-25 14:00:26 +00:00
|
|
|
| ^^^^^^
|
|
|
|
| |
|
|
|
|
| expected &str, found str
|
|
|
|
| help: consider borrowing here: `&s[..2]`
|
2017-11-24 22:47:40 +00:00
|
|
|
|
|
|
|
|
= 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"
|