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