]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-11552.rs
Consider privacy more carefully when suggesting accessing fields
[rust.git] / src / test / ui / issues / issue-11552.rs
1 // run-pass
2 #![feature(box_patterns)]
3 #![feature(box_syntax)]
4
5 #[derive(Clone)]
6 enum Noun
7 {
8     Atom(isize),
9     Cell(Box<Noun>, Box<Noun>)
10 }
11
12 fn fas(n: &Noun) -> Noun
13 {
14     match n {
15         &Noun::Cell(box Noun::Atom(2), box Noun::Cell(ref a, _)) => (**a).clone(),
16         _ => panic!("Invalid fas pattern")
17     }
18 }
19
20 pub fn main() {
21     fas(&Noun::Cell(box Noun::Atom(2), box Noun::Cell(box Noun::Atom(2), box Noun::Atom(3))));
22 }