about summary refs log tree commit diff
path: root/src/test/compile-fail/private-method-inherited.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/compile-fail/private-method-inherited.rs')
-rw-r--r--src/test/compile-fail/private-method-inherited.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/compile-fail/private-method-inherited.rs b/src/test/compile-fail/private-method-inherited.rs
new file mode 100644
index 00000000000..7b64623e16c
--- /dev/null
+++ b/src/test/compile-fail/private-method-inherited.rs
@@ -0,0 +1,15 @@
+// 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 method `f` is private
+}
+