summaryrefslogtreecommitdiffstats
path: root/tests/ui/str/str-array-assignment.rs
blob: 323eefb381af92b1eb2de54d88c165d35a59083c (plain)
1
2
3
4
5
6
7
8
9
10
11
fn main() {
  let s = "abc";
  let t = if true { s[..2] } else { s };
  //~^ ERROR `if` and `else` have incompatible types
  let u: &str = if true { s[..2] } else { s };
  //~^ ERROR mismatched types
  let v = s[..2];
  //~^ ERROR the size for values of type
  let w: &str = s[..2];
  //~^ ERROR mismatched types
}