about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-17 08:51:38 +0000
committerbors <bors@rust-lang.org>2015-01-17 08:51:38 +0000
commit3e6eaeb69ff729096253670aba752c03225113bc (patch)
treefa2c530c596734581ec71e241d2262c0d2a0a48f /src/test
parent378fb5846d2d8dbc5ab24a5e92794c5c39d492dc (diff)
parent811522260760d5c1d6a4c8162ba816a471f37232 (diff)
downloadrust-3e6eaeb69ff729096253670aba752c03225113bc.tar.gz
rust-3e6eaeb69ff729096253670aba752c03225113bc.zip
auto merge of #21205 : alexcrichton/rust/issue-21202, r=nikomatsakis
Loading methods from external crates was erroneously using the type's privacy
for each method instead of each method's privacy. This commit fixes that.

Closes #21202

This commit also moves privacy to its own crate because I thought that was where the bug was. Turns out it wasn't, but it helped me iterate at least!
Diffstat (limited to 'src/test')
-rw-r--r--src/test/auxiliary/issue-21202.rs16
-rw-r--r--src/test/compile-fail/issue-21202.rs25
2 files changed, 41 insertions, 0 deletions
diff --git a/src/test/auxiliary/issue-21202.rs b/src/test/auxiliary/issue-21202.rs
new file mode 100644
index 00000000000..afdbf78aa82
--- /dev/null
+++ b/src/test/auxiliary/issue-21202.rs
@@ -0,0 +1,16 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub mod A {
+    pub struct Foo;
+    impl Foo {
+        fn foo(&self) { }
+    }
+}
diff --git a/src/test/compile-fail/issue-21202.rs b/src/test/compile-fail/issue-21202.rs
new file mode 100644
index 00000000000..5c1de6dfc55
--- /dev/null
+++ b/src/test/compile-fail/issue-21202.rs
@@ -0,0 +1,25 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:issue-21202.rs
+
+extern crate "issue-21202" as crate1;
+
+use crate1::A;
+
+mod B {
+    use crate1::A::Foo;
+    fn bar(f: Foo) {
+        Foo::foo(&f);
+        //~^ ERROR: function `foo` is private
+    }
+}
+
+fn main() { }