Skip to content

Commit 955bf29

Browse files
committed
auto merge of #16740 : alexcrichton/rust/issue-16725, r=pcwalton
Closes #16725
2 parents 0b3e43d + acc08c8 commit 955bf29

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/librustc/metadata/encoder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,7 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
13711371

13721372
rbml_w.start_tag(tag_items_data_item);
13731373
encode_def_id(rbml_w, local_def(nitem.id));
1374+
encode_visibility(rbml_w, nitem.vis);
13741375
match nitem.node {
13751376
ForeignItemFn(..) => {
13761377
encode_family(rbml_w, style_fn_family(NormalFn));

src/test/auxiliary/issue-16725.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
extern {
12+
fn bar();
13+
}
14+

src/test/compile-fail/issue-16725.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-16725.rs
12+
13+
extern crate foo = "issue-16725";
14+
15+
fn main() {
16+
unsafe { foo::bar(); }
17+
//~^ ERROR: function `bar` is private
18+
}
19+

0 commit comments

Comments
 (0)