summaryrefslogtreecommitdiffstats
path: root/src/test/ui/privacy/union-field-privacy-2.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/privacy/union-field-privacy-2.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/privacy/union-field-privacy-2.rs b/src/test/ui/privacy/union-field-privacy-2.rs
new file mode 100644
index 000000000..f02e0f8a9
--- /dev/null
+++ b/src/test/ui/privacy/union-field-privacy-2.rs
@@ -0,0 +1,15 @@
+mod m {
+ pub union U {
+ pub a: u8,
+ pub(super) b: u8,
+ c: u8,
+ }
+}
+
+fn main() {
+ let u = m::U { a: 10 };
+
+ let a = u.a; // OK
+ let b = u.b; // OK
+ let c = u.c; //~ ERROR field `c` of union `U` is private
+}