about summary refs log tree commit diff
path: root/tests/ui/privacy/private-method-inherited.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/privacy/private-method-inherited.rs')
-rw-r--r--tests/ui/privacy/private-method-inherited.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/privacy/private-method-inherited.rs b/tests/ui/privacy/private-method-inherited.rs
new file mode 100644
index 00000000000..2f6454288ae
--- /dev/null
+++ b/tests/ui/privacy/private-method-inherited.rs
@@ -0,0 +1,14 @@
+// Tests that inherited visibility applies to methods.
+
+mod a {
+    pub struct Foo;
+
+    impl Foo {
+        fn f(self) {}
+    }
+}
+
+fn main() {
+    let x = a::Foo;
+    x.f();  //~ ERROR associated function `f` is private
+}