gcc/testsuite/rust/compile/privacy5.rs
raw| 1 | mod orange { |
| 2 | mod green { |
| 3 | struct Foo; |
| 4 | pub(in orange) struct Bar; |
| 5 | pub struct Baz; |
| 6 | } |
| 7 | |
| 8 | fn brown() {// E0603 |
| 9 | let _ = green::Foo; // { dg-error "definition is private in this context" } |
| 10 | let _ = green::Bar; |
| 11 | let _ = green::Baz; |
| 12 | |
| 13 | let _: green::Foo; // { dg-error "definition is private in this context" } |
| 14 | |
| 15 | fn any(a0: green::Foo, a1: green::Bar) {} // { dg-error "20:definition is private in this context" } |
| 16 | } |
| 17 | } |