summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/private-struct-field.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/privacy/private-struct-field.rs')
-rw-r--r--tests/ui/privacy/private-struct-field.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/privacy/private-struct-field.rs b/tests/ui/privacy/private-struct-field.rs
new file mode 100644
index 000000000..94cee4eff
--- /dev/null
+++ b/tests/ui/privacy/private-struct-field.rs
@@ -0,0 +1,14 @@
+mod cat {
+ pub struct Cat {
+ meows: usize
+ }
+
+ pub fn new_cat() -> Cat {
+ Cat { meows: 52 }
+ }
+}
+
+fn main() {
+ let nyan = cat::new_cat();
+ assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `Cat` is private
+}