2017-11-24 14:47:40 -08:00
|
|
|
error[E0308]: if and else have incompatible types
|
|
|
|
--> $DIR/str-array-assignment.rs:13:11
|
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | let t = if true { s[..2] } else { s };
|
2017-11-24 14:47:40 -08:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str
|
|
|
|
|
|
|
|
|
= note: expected type `str`
|
|
|
|
found type `&str`
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2017-12-10 23:29:24 +03:00
|
|
|
--> $DIR/str-array-assignment.rs:15:27
|
2017-11-24 14:47:40 -08:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | let u: &str = if true { s[..2] } else { s };
|
2018-06-26 11:39:37 -07:00
|
|
|
| ^^^^^^
|
|
|
|
| |
|
|
|
|
| expected &str, found str
|
|
|
|
| help: consider borrowing here: `&s[..2]`
|
2017-11-24 14:47:40 -08:00
|
|
|
|
|
|
|
|
= note: expected type `&str`
|
|
|
|
found type `str`
|
|
|
|
|
2018-06-19 15:53:51 -07:00
|
|
|
error[E0277]: the size for value values of type `str` cannot be known at compilation time
|
2017-12-10 23:29:24 +03:00
|
|
|
--> $DIR/str-array-assignment.rs:17:7
|
2017-11-24 14:47:40 -08:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | let v = s[..2];
|
2017-11-26 12:52:00 -08:00
|
|
|
| ^ ------ help: consider borrowing here: `&s[..2]`
|
2017-11-24 14:47:40 -08:00
|
|
|
| |
|
2018-06-19 15:53:51 -07:00
|
|
|
| doesn't have a size known at compile-time
|
2017-11-24 14:47:40 -08:00
|
|
|
|
|
|
|
|
= help: the trait `std::marker::Sized` is not implemented for `str`
|
2018-06-09 18:37:52 -07:00
|
|
|
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized>
|
2017-11-24 14:47:40 -08:00
|
|
|
= note: all local variables must have a statically known size
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2017-12-10 23:29:24 +03:00
|
|
|
--> $DIR/str-array-assignment.rs:19:17
|
2017-11-24 14:47:40 -08:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | let w: &str = s[..2];
|
2017-11-25 06:00:26 -08:00
|
|
|
| ^^^^^^
|
|
|
|
| |
|
|
|
|
| expected &str, found str
|
|
|
|
| help: consider borrowing here: `&s[..2]`
|
2017-11-24 14:47:40 -08:00
|
|
|
|
|
|
|
|
= note: expected type `&str`
|
|
|
|
found type `str`
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|
2018-03-03 15:59:40 +01:00
|
|
|
Some errors occurred: E0277, E0308.
|
|
|
|
For more information about an error, try `rustc --explain E0277`.
|