rust/tests/ui/issues/issue-8498.rs

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

28 lines
534 B
Rust
Raw Normal View History

// run-pass
pub fn main() {
match &[(Box::new(5),Box::new(7))] {
2013-08-13 22:57:37 +00:00
ps => {
let (ref y, _) = ps[0];
assert_eq!(**y, 5);
2013-08-13 22:57:37 +00:00
}
}
match Some(&[(Box::new(5),)]) {
2013-08-13 22:57:37 +00:00
Some(ps) => {
let (ref y,) = ps[0];
assert_eq!(**y, 5);
2013-08-13 22:57:37 +00:00
}
None => ()
}
match Some(&[(Box::new(5),Box::new(7))]) {
2013-08-13 22:57:37 +00:00
Some(ps) => {
let (ref y, ref z) = ps[0];
assert_eq!(**y, 5);
assert_eq!(**z, 7);
2013-08-13 22:57:37 +00:00
}
None => ()
}
}