]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-25386.rs
Rollup merge of #106896 - Ezrashaw:str-cast-bool-emptyness, r=compiler-errors
[rust.git] / tests / 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 `c_object` of struct `Item` is private
21     );
22 }
23
24 fn main() {
25     let item = stuff::Item::new();
26     println!("{}", check_ptr_exist!(item, name));
27 }