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

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

25 lines
454 B
Rust
Raw Normal View History

// run-pass
#![feature(box_patterns)]
#[derive(Clone)]
2014-03-01 06:05:49 +00:00
enum Noun
{
Atom(isize),
Cell(Box<Noun>, Box<Noun>)
2014-03-01 06:05:49 +00:00
}
fn fas(n: &Noun) -> Noun
{
match n {
&Noun::Cell(box Noun::Atom(2), box Noun::Cell(ref a, _)) => (**a).clone(),
_ => panic!("Invalid fas pattern")
2014-03-01 06:05:49 +00:00
}
}
pub fn main() {
fas(
&Noun::Cell(Box::new(Noun::Atom(2)),
Box::new(Noun::Cell(Box::new(Noun::Atom(2)), Box::new(Noun::Atom(3)))))
);
2014-03-01 06:05:49 +00:00
}