fork/rust
git clone https://git.julia.blue/fork/rust
73528e339aa
1.40.0
1error[E0308]: if and else have incompatible types 2 --> $DIR/str-array-assignment.rs:3:37 3 | 4LL | let t = if true { s[..2] } else { s }; 5 | ------ ^ expected str, found &str 6 | | 7 | expected because of this 8 | 9 = note: expected type `str` 10 found type `&str` 11 12error[E0308]: mismatched types 13 --> $DIR/str-array-assignment.rs:5:27 14 | 15LL | let u: &str = if true { s[..2] } else { s }; 16 | ^^^^^^ 17 | | 18 | expected &str, found str 19 | help: consider borrowing here: `&s[..2]` 20 | 21 = note: expected type `&str` 22 found type `str` 23 24error[E0277]: the size for values of type `str` cannot be known at compilation time 25 --> $DIR/str-array-assignment.rs:7:7 26 | 27LL | let v = s[..2]; 28 | ^ ------ help: consider borrowing here: `&s[..2]` 29 | | 30 | doesn't have a size known at compile-time 31 | 32 = help: the trait `std::marker::Sized` is not implemented for `str` 33 = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> 34 = note: all local variables must have a statically known size 35 = help: unsized locals are gated as an unstable feature 36 37error[E0308]: mismatched types 38 --> $DIR/str-array-assignment.rs:9:17 39 | 40LL | let w: &str = s[..2]; 41 | ^^^^^^ 42 | | 43 | expected &str, found str 44 | help: consider borrowing here: `&s[..2]` 45 | 46 = note: expected type `&str` 47 found type `str` 48 49error: aborting due to 4 previous errors 50 51Some errors have detailed explanations: E0277, E0308. 52For more information about an error, try `rustc --explain E0277`.