rust/tests/ui/str/str-array-assignment.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
315 B
Rust
Raw Normal View History

fn main() {
let s = "abc";
let t = if true { s[..2] } else { s };
2020-01-05 00:17:46 +00:00
//~^ ERROR `if` and `else` have incompatible types
let u: &str = if true { s[..2] } else { s };
//~^ ERROR mismatched types
let v = s[..2];
2018-07-10 21:10:13 +00:00
//~^ ERROR the size for values of type
let w: &str = s[..2];
//~^ ERROR mismatched types
}