Files
rust/tests/ui/array-slice-vec/vector-slice-matching-8498.rs

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

29 lines
584 B
Rust
Raw Normal View History

2025-07-13 16:56:31 -04:00
// https://github.com/rust-lang/rust/issues/8498
//@ run-pass
pub fn main() {
match &[(Box::new(5),Box::new(7))] {
2013-08-13 15:57:37 -07:00
ps => {
let (ref y, _) = ps[0];
assert_eq!(**y, 5);
2013-08-13 15:57:37 -07:00
}
}
match Some(&[(Box::new(5),)]) {
2013-08-13 15:57:37 -07:00
Some(ps) => {
let (ref y,) = ps[0];
assert_eq!(**y, 5);
2013-08-13 15:57:37 -07:00
}
None => ()
}
match Some(&[(Box::new(5),Box::new(7))]) {
2013-08-13 15:57:37 -07:00
Some(ps) => {
let (ref y, ref z) = ps[0];
assert_eq!(**y, 5);
assert_eq!(**z, 7);
2013-08-13 15:57:37 -07:00
}
None => ()
}
}