Permalink
Browse files

auto merge of #5442 : pcwalton/rust/extern-block-restriction, r=pcwalton

  • Loading branch information...
2 parents 4cb9ca9 + f8dab3a commit f3c879fdd8aad67cf4f6edd3aacb0189c284c920 @bors bors committed Mar 20, 2013
View
@@ -1221,9 +1221,8 @@ pub mod funcs {
#[nolink]
#[abi = "cdecl"]
pub mod fcntl {
+ use libc::types::os::arch::c95::{c_int, c_char};
pub extern {
- use libc::types::os::arch::c95::{c_int, c_char};
-
#[link_name = "_open"]
unsafe fn open(path: *c_char, oflag: c_int, mode: c_int)
-> c_int;
@@ -1562,11 +1561,11 @@ pub mod funcs {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
pub mod bsd44 {
+ use libc::types::common::c95::{c_void};
+ use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
+
#[abi = "cdecl"]
pub extern {
- use libc::types::common::c95::{c_void};
- use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t};
-
unsafe fn sysctl(name: *c_int, namelen: c_uint,
oldp: *mut c_void, oldlenp: *mut size_t,
newp: *c_void, newlen: size_t) -> c_int;
@@ -44,4 +44,4 @@ pub fn get() -> &Environment {
extern {
fn rust_get_rt_env() -> &Environment;
-}
+}
@@ -70,7 +70,7 @@ enum CleanupJob {
pub impl Scheduler {
- static fn new(event_loop: ~EventLoopObject) -> Scheduler {
+ static pub fn new(event_loop: ~EventLoopObject) -> Scheduler {
Scheduler {
event_loop: event_loop,
task_queue: WorkQueue::new(),
@@ -296,7 +296,7 @@ pub struct Task {
}
impl Task {
- static fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
+ static pub fn new(stack_pool: &mut StackPool, start: ~fn()) -> Task {
// XXX: Putting main into a ~ so it's a thin pointer and can
// be passed to the spawn function. Another unfortunate
// allocation
@@ -37,8 +37,7 @@ pub impl StackSegment {
pub struct StackPool(());
impl StackPool {
-
- static fn new() -> StackPool { StackPool(()) }
+ static pub fn new() -> StackPool { StackPool(()) }
fn take_segment(&self, min_size: uint) -> StackSegment {
StackSegment::new(min_size)
@@ -20,7 +20,7 @@ struct Thread {
}
impl Thread {
- static fn start(main: ~fn()) -> Thread {
+ static pub fn start(main: ~fn()) -> Thread {
fn substart(main: &fn()) -> *raw_thread {
unsafe { rust_raw_thread_start(&main) }
}
@@ -30,7 +30,7 @@ pub type rust_task = libc::c_void;
#[allow(non_camel_case_types)] // runtime type
pub type rust_closure = libc::c_void;
-extern {
+pub extern {
#[rust_stack]
fn rust_task_yield(task: *rust_task) -> bool;
@@ -146,6 +146,7 @@ fn item_family(item: ebml::Doc) -> Family {
fn item_visibility(item: ebml::Doc) -> ast::visibility {
let visibility = reader::get_doc(item, tag_items_data_item_visibility);
+ debug!("item visibility for %?", item_family(item));
match reader::doc_as_u8(visibility) as char {
'y' => ast::public,
'n' => ast::private,
@@ -896,6 +896,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
encode_family(ebml_w, purity_fn_family(mty.fty.purity));
encode_self_type(ebml_w, mty.self_ty);
encode_method_sort(ebml_w, 'r');
+ encode_visibility(ebml_w, ast::public);
ebml_w.end_tag();
}
provided(m) => {
@@ -911,6 +912,7 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
encode_family(ebml_w, purity_fn_family(mty.fty.purity));
encode_self_type(ebml_w, mty.self_ty);
encode_method_sort(ebml_w, 'p');
+ encode_visibility(ebml_w, m.vis);
ebml_w.end_tag();
}
}
@@ -945,6 +947,11 @@ fn encode_info_for_item(ecx: @EncodeContext, ebml_w: writer::Encoder,
let mut m_path = vec::append(~[], path); // :-(
m_path += [ast_map::path_name(item.ident)];
encode_path(ecx, ebml_w, m_path, ast_map::path_name(ty_m.ident));
+
+ // For now, use the item visibility until trait methods can have
+ // real visibility in the AST.
+ encode_visibility(ebml_w, item.vis);
+
ebml_w.end_tag();
}
@@ -1033,7 +1040,7 @@ fn encode_info_for_items(ecx: @EncodeContext, ebml_w: writer::Encoder,
|ni, cx, v| {
visit::visit_foreign_item(ni, cx, v);
match ecx.tcx.items.get(&ni.id) {
- ast_map::node_foreign_item(_, abi, pt) => {
+ ast_map::node_foreign_item(_, abi, _, pt) => {
encode_info_for_foreign_item(ecx, ebml_w, ni,
index, /*bad*/copy *pt,
abi);
Oops, something went wrong.

0 comments on commit f3c879f

Please sign in to comment.