]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-3763.rs
New upstream version 1.43.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-3763.rs
CommitLineData
74b04a01
XL
1// compile-flags: -Zsave-analysis
2// Also regression test for #69416
3
223e47cc
LB
4mod my_mod {
5 pub struct MyStruct {
1a4d82fc 6 priv_field: isize
223e47cc
LB
7 }
8 pub fn MyStruct () -> MyStruct {
9 MyStruct {priv_field: 4}
10 }
970d7e83 11 impl MyStruct {
1a4d82fc 12 fn happyfun(&self) {}
223e47cc
LB
13 }
14}
15
16fn main() {
17 let my_struct = my_mod::MyStruct();
1a4d82fc
JJ
18 let _woohoo = (&my_struct).priv_field;
19 //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
c34b1796 20
c34b1796 21 let _woohoo = (Box::new(my_struct)).priv_field;
1a4d82fc 22 //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
c34b1796 23
223e47cc 24 (&my_struct).happyfun(); //~ ERROR method `happyfun` is private
c34b1796 25
c34b1796 26 (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private
1a4d82fc
JJ
27 let nope = my_struct.priv_field;
28 //~^ ERROR field `priv_field` of struct `my_mod::MyStruct` is private
223e47cc 29}