about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-08-25 12:10:56 +0000
committerbors <bors@rust-lang.org>2014-08-25 12:10:56 +0000
commit5fb2dfaa200f2cb32e77c54ae8a5e0f4823b65c8 (patch)
treed076d1055023820ff815ad82d58f4d046a0f8490 /src
parent0b3e43d2a47ecf4908a912c1144942e5216703ea (diff)
parent1c76d559c37bf313a31e260b986255cc45912014 (diff)
downloadrust-5fb2dfaa200f2cb32e77c54ae8a5e0f4823b65c8.tar.gz
rust-5fb2dfaa200f2cb32e77c54ae8a5e0f4823b65c8.zip
auto merge of #16740 : alexcrichton/rust/issue-16725, r=pcwalton
Closes #16725
Diffstat (limited to 'src')
-rw-r--r--src/librustc/metadata/encoder.rs1
-rw-r--r--src/test/auxiliary/foreign_lib.rs2
-rw-r--r--src/test/auxiliary/issue-16725.rs14
-rw-r--r--src/test/compile-fail/issue-16725.rs19
4 files changed, 35 insertions, 1 deletions
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 29b5db51cc4..ffa4a1b5bf0 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1371,6 +1371,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
 
     rbml_w.start_tag(tag_items_data_item);
     encode_def_id(rbml_w, local_def(nitem.id));
+    encode_visibility(rbml_w, nitem.vis);
     match nitem.node {
       ForeignItemFn(..) => {
         encode_family(rbml_w, style_fn_family(NormalFn));
diff --git a/src/test/auxiliary/foreign_lib.rs b/src/test/auxiliary/foreign_lib.rs
index a6bbd40f810..500475091e0 100644
--- a/src/test/auxiliary/foreign_lib.rs
+++ b/src/test/auxiliary/foreign_lib.rs
@@ -15,6 +15,6 @@ pub mod rustrt {
 
     #[link(name = "rust_test_helpers")]
     extern {
-        fn rust_get_test_int() -> libc::intptr_t;
+        pub fn rust_get_test_int() -> libc::intptr_t;
     }
 }
diff --git a/src/test/auxiliary/issue-16725.rs b/src/test/auxiliary/issue-16725.rs
new file mode 100644
index 00000000000..7f388c13e15
--- /dev/null
+++ b/src/test/auxiliary/issue-16725.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 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.
+
+extern {
+    fn bar();
+}
+
diff --git a/src/test/compile-fail/issue-16725.rs b/src/test/compile-fail/issue-16725.rs
new file mode 100644
index 00000000000..f70d88a41cd
--- /dev/null
+++ b/src/test/compile-fail/issue-16725.rs
@@ -0,0 +1,19 @@
+// Copyright 2014 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-16725.rs
+
+extern crate foo = "issue-16725";
+
+fn main() {
+    unsafe { foo::bar(); }
+    //~^ ERROR: function `bar` is private
+}
+