diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-25386.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-25386.rs b/src/test/ui/issues/issue-25386.rs new file mode 100644 index 000000000..a76d8a615 --- /dev/null +++ b/src/test/ui/issues/issue-25386.rs @@ -0,0 +1,28 @@ +mod stuff { + pub struct Item { + c_object: Box<CObj>, + } + pub struct CObj { + name: Option<String>, + } + impl Item { + pub fn new() -> Item { + Item { + c_object: Box::new(CObj { name: None }), + } + } + } +} + +macro_rules! check_ptr_exist { + ($var:expr, $member:ident) => ( + (*$var.c_object).$member.is_some() + //~^ ERROR field `c_object` of struct `Item` is private + ); +} + +fn main() { + let item = stuff::Item::new(); + println!("{}", check_ptr_exist!(item, name)); + //~^ ERROR field `name` of struct `CObj` is private +} |