diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 29b5db51cc429b55a5f1bbb954b028d0f7fb6e88..ffa4a1b5bf0838f62a856c0fe92ce4732708596a 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 a6bbd40f81088fbc738bc508ad5c0665e03dcf94..500475091e0d3f883d650f83f29b120c30e0cf07 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 0000000000000000000000000000000000000000..7f388c13e15a8a7351d1a6d3d0439c99e8bc1f27 --- /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 or the MIT license +// , 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 0000000000000000000000000000000000000000..f70d88a41cd1f5e02d09c5de65749771f69cf43c --- /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 or the MIT license +// , 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 +} +