5 pub fn MyStruct () -> MyStruct {
6 MyStruct {priv_field: 4}
14 let my_struct = my_mod::MyStruct();
15 let _woohoo = (&my_struct).priv_field;
16 //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
18 let _woohoo = (Box::new(my_struct)).priv_field;
19 //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
21 (&my_struct).happyfun(); //~ ERROR method `happyfun` is private
23 (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private
24 let nope = my_struct.priv_field;
25 //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private