Skip to content

Commit

Permalink
librustc: Don't require pub extern to make extern functions visible
Browse files Browse the repository at this point in the history
  • Loading branch information
pcwalton committed Jun 1, 2013
1 parent b8391cc commit 1e52eed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ pub fn check_crate(tcx: ty::ctxt,
f = |item_id| {
match tcx.items.find(&item_id) {
Some(&node_item(item, _)) => item.vis != public,
Some(&node_foreign_item(_, _, vis, _)) => vis != public,
Some(&node_foreign_item(*)) => false,
Some(&node_method(method, impl_did, _)) => {
match method.vis {
private => true,
Expand Down
14 changes: 14 additions & 0 deletions src/test/run-pass/pub-extern-privacy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use std::cast::transmute;

mod a {
extern {
pub fn free(x: *u8);
}
}

fn main() {
unsafe {
a::free(transmute(0));
}
}

0 comments on commit 1e52eed

Please sign in to comment.