Skip to content

Commit c582e3e

Browse files
committed
librustc: Don't require pub extern to make extern functions visible
1 parent 5028ac7 commit c582e3e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/librustc/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub fn check_crate(tcx: ty::ctxt,
200200
f = |item_id| {
201201
match tcx.items.find(&item_id) {
202202
Some(&node_item(item, _)) => item.vis != public,
203-
Some(&node_foreign_item(_, _, vis, _)) => vis != public,
203+
Some(&node_foreign_item(*)) => false,
204204
Some(&node_method(method, impl_did, _)) => {
205205
match method.vis {
206206
private => true,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use std::cast::transmute;
2+
3+
mod a {
4+
extern {
5+
pub fn free(x: *u8);
6+
}
7+
}
8+
9+
fn main() {
10+
unsafe {
11+
a::free(transmute(0));
12+
}
13+
}
14+

0 commit comments

Comments
 (0)