]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-25386.rs
Auto merge of #57108 - Mark-Simulacrum:license-remove, r=pietroalbini
[rust.git] / src / test / ui / issues / issue-25386.rs
1 mod stuff {
2     pub struct Item {
3         c_object: Box<CObj>,
4     }
5     pub struct CObj {
6         name: Option<String>,
7     }
8     impl Item {
9         pub fn new() -> Item {
10             Item {
11                 c_object: Box::new(CObj { name: None }),
12             }
13         }
14     }
15 }
16
17 macro_rules! check_ptr_exist {
18     ($var:expr, $member:ident) => (
19         (*$var.c_object).$member.is_some()
20         //~^ ERROR field `name` of struct `stuff::CObj` is private
21         //~^^ ERROR field `c_object` of struct `stuff::Item` is private
22     );
23 }
24
25 fn main() {
26     let item = stuff::Item::new();
27     println!("{}", check_ptr_exist!(item, name));
28 }