1 // compile-flags: -Zsave-analysis
2 // Also regression test for #69416
8 pub fn MyStruct () -> MyStruct {
9 MyStruct {priv_field: 4}
17 let my_struct = my_mod::MyStruct();
18 let _woohoo = (&my_struct).priv_field;
19 //~^ ERROR field `priv_field` of struct `MyStruct` is private
21 let _woohoo = (Box::new(my_struct)).priv_field;
22 //~^ ERROR field `priv_field` of struct `MyStruct` is private
24 (&my_struct).happyfun(); //~ ERROR associated function `happyfun` is private
26 (Box::new(my_struct)).happyfun(); //~ ERROR associated function `happyfun` is private
27 let nope = my_struct.priv_field;
28 //~^ ERROR field `priv_field` of struct `MyStruct` is private