Skip to content

Commit f3c879f

Browse files
committed
auto merge of #5442 : pcwalton/rust/extern-block-restriction, r=pcwalton
r? @graydon
2 parents 4cb9ca9 + f8dab3a commit f3c879f

28 files changed

+411
-188
lines changed

src/libcore/libc.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1221,9 +1221,8 @@ pub mod funcs {
12211221
#[nolink]
12221222
#[abi = "cdecl"]
12231223
pub mod fcntl {
1224+
use libc::types::os::arch::c95::{c_int, c_char};
12241225
pub extern {
1225-
use libc::types::os::arch::c95::{c_int, c_char};
1226-
12271226
#[link_name = "_open"]
12281227
unsafe fn open(path: *c_char, oflag: c_int, mode: c_int)
12291228
-> c_int;
@@ -1562,11 +1561,11 @@ pub mod funcs {
15621561
#[cfg(target_os = "macos")]
15631562
#[cfg(target_os = "freebsd")]
15641563
pub mod bsd44 {
1564+
use libc::types::common::c95::{c_void};
1565+
use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1566+
15651567
#[abi = "cdecl"]
15661568
pub extern {
1567-
use libc::types::common::c95::{c_void};
1568-
use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
1569-
15701569
unsafe fn sysctl(name: *c_int, namelen: c_uint,
15711570
oldp: *mut c_void, oldlenp: *mut size_t,
15721571
newp: *c_void, newlen: size_t) -> c_int;

src/libcore/rt/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ pub fn get() -> &Environment {
4444

4545
extern {
4646
fn rust_get_rt_env() -> &Environment;
47-
}
47+
}

src/libcore/rt/sched.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ enum CleanupJob {
7070

7171
pub impl Scheduler {
7272

73-
static fn new(event_loop: ~EventLoopObject) -> Scheduler {
73+
static pub fn new(event_loop: ~EventLoopObject) -> Scheduler {
7474
Scheduler {
7575
event_loop: event_loop,
7676
task_queue: WorkQueue::new(),
@@ -296,7 +296,7 @@ pub struct Task {
296296
}
297297

298298
impl Task {
299-
static fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
299+
static pub fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
300300
// XXX: Putting main into a ~ so it's a thin pointer and can
301301
// be passed to the spawn function. Another unfortunate
302302
// allocation

src/libcore/rt/stack.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ pub impl StackSegment {
3737
pub struct StackPool(());
3838

3939
impl StackPool {
40-
41-
static fn new() -> StackPool { StackPool(()) }
40+
static pub fn new() -> StackPool { StackPool(()) }
4241

4342
fn take_segment(&self, min_size: uint) -> StackSegment {
4443
StackSegment::new(min_size)

src/libcore/rt/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct Thread {
2020
}
2121

2222
impl Thread {
23-
static fn start(main: ~fn()) -> Thread {
23+
static pub fn start(main: ~fn()) -> Thread {
2424
fn substart(main: &fn()) -> *raw_thread {
2525
unsafe { rust_raw_thread_start(&main) }
2626
}

src/libcore/task/rt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub type rust_task = libc::c_void;
3030
#[allow(non_camel_case_types)] // runtime type
3131
pub type rust_closure = libc::c_void;
3232

33-
extern {
33+
pub extern {
3434
#[rust_stack]
3535
fn rust_task_yield(task: *rust_task) -> bool;
3636

src/librustc/metadata/decoder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ fn item_family(item: ebml::Doc) -> Family {
146146

147147
fn item_visibility(item: ebml::Doc) -> ast::visibility {
148148
let visibility = reader::get_doc(item, tag_items_data_item_visibility);
149+
debug!("item visibility for %?", item_family(item));
149150
match reader::doc_as_u8(visibility) as char {
150151
'y' => ast::public,
151152
'n' => ast::private,

src/librustc/metadata/encoder.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
896896
encode_family(ebml_w, purity_fn_family(mty.fty.purity));
897897
encode_self_type(ebml_w, mty.self_ty);
898898
encode_method_sort(ebml_w, 'r');
899+
encode_visibility(ebml_w, ast::public);
899900
ebml_w.end_tag();
900901
}
901902
provided(m) => {
@@ -911,6 +912,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
911912
encode_family(ebml_w, purity_fn_family(mty.fty.purity));
912913
encode_self_type(ebml_w, mty.self_ty);
913914
encode_method_sort(ebml_w, 'p');
915+
encode_visibility(ebml_w, m.vis);
914916
ebml_w.end_tag();
915917
}
916918
}
@@ -945,6 +947,11 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
945947
let mut m_path = vec::append(~[], path); // :-(
946948
m_path += [ast_map::path_name(item.ident)];
947949
encode_path(ecx, ebml_w, m_path, ast_map::path_name(ty_m.ident));
950+
951+
// For now, use the item visibility until trait methods can have
952+
// real visibility in the AST.
953+
encode_visibility(ebml_w, item.vis);
954+
948955
ebml_w.end_tag();
949956
}
950957
@@ -1033,7 +1040,7 @@ fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder,
10331040
|ni, cx, v| {
10341041
visit::visit_foreign_item(ni, cx, v);
10351042
match ecx.tcx.items.get(&ni.id) {
1036-
ast_map::node_foreign_item(_, abi, pt) => {
1043+
ast_map::node_foreign_item(_, abi, _, pt) => {
10371044
encode_info_for_foreign_item(ecx, ebml_w, ni,
10381045
index, /*bad*/copy *pt,
10391046
abi);

0 commit comments

Comments
 (0)