2019-04-30 02:16:35 +00:00
|
|
|
fn main() {
|
|
|
|
let x = vec![1i32];
|
|
|
|
match &x[..] {
|
|
|
|
[&v] => {}, //~ ERROR mismatched types
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
match x {
|
|
|
|
[&v] => {}, //~ ERROR expected an array or slice
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
match &x[..] {
|
|
|
|
[v] => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
match &x[..] {
|
|
|
|
&[v] => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
match x {
|
|
|
|
[v] => {}, //~ ERROR expected an array or slice
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
let y = 1i32;
|
|
|
|
match &y {
|
|
|
|
&v => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
match y {
|
|
|
|
&v => {}, //~ ERROR mismatched types
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
match &y {
|
|
|
|
v => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
match y {
|
|
|
|
v => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
2019-04-30 03:58:29 +00:00
|
|
|
if let [&v] = &x[..] {} //~ ERROR mismatched types
|
2019-04-30 02:16:35 +00:00
|
|
|
}
|