libcore: De-export libcore. rs=deexporting

This commit is contained in:
Patrick Walton 2013-01-29 11:47:18 -08:00
parent 4ead38bae7
commit d0391c5b09
10 changed files with 73 additions and 90 deletions

View File

@ -29,16 +29,14 @@ use vec;
#[abi = "cdecl"]
pub extern mod rustrt {
#[legacy_exports];
unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
++v: **vec::raw::VecRepr,
++n: libc::size_t);
pub unsafe fn vec_reserve_shared_actual(++t: *sys::TypeDesc,
++v: **vec::raw::VecRepr,
++n: libc::size_t);
}
#[abi = "rust-intrinsic"]
pub extern mod rusti {
#[legacy_exports];
fn move_val_init<T>(dst: &mut T, -src: T);
pub fn move_val_init<T>(dst: &mut T, -src: T);
}
/// Returns the number of elements the vector can hold without reallocating

View File

@ -161,9 +161,8 @@ pub unsafe fn annihilate() {
/// Bindings to the runtime
extern mod rustrt {
#[legacy_exports];
#[rust_stack]
// FIXME (#4386): Unable to make following method private.
/* priv */ unsafe fn rust_get_task() -> *c_void;
pub unsafe fn rust_get_task() -> *c_void;
}

View File

@ -488,15 +488,13 @@ impl<T: Copy> DList<T> {
#[cfg(test)]
mod tests {
#[legacy_exports];
use dlist::{DList, concat, from_vec, new_dlist_node};
use iter;
use option::{None, Some};
use vec;
#[test]
fn test_dlist_concat() {
pub fn test_dlist_concat() {
let a = from_vec(~[1,2]);
let b = from_vec(~[3,4]);
let c = from_vec(~[5,6]);
@ -516,7 +514,7 @@ mod tests {
abcd.assert_consistent(); assert abcd.is_empty();
}
#[test]
fn test_dlist_append() {
pub fn test_dlist_append() {
let a = from_vec(~[1,2,3]);
let b = from_vec(~[4,5,6]);
a.append(b);
@ -532,7 +530,7 @@ mod tests {
a.assert_consistent(); assert a.is_empty();
}
#[test]
fn test_dlist_append_empty() {
pub fn test_dlist_append_empty() {
let a = from_vec(~[1,2,3]);
let b = DList::<int>();
a.append(b);
@ -545,7 +543,7 @@ mod tests {
a.assert_consistent(); assert a.is_empty();
}
#[test]
fn test_dlist_append_to_empty() {
pub fn test_dlist_append_to_empty() {
let a = DList::<int>();
let b = from_vec(~[4,5,6]);
a.append(b);
@ -558,7 +556,7 @@ mod tests {
a.assert_consistent(); assert a.is_empty();
}
#[test]
fn test_dlist_append_two_empty() {
pub fn test_dlist_append_two_empty() {
let a = DList::<int>();
let b = DList::<int>();
a.append(b);
@ -570,19 +568,19 @@ mod tests {
#[test]
#[ignore(cfg(windows))]
#[should_fail]
fn test_dlist_append_self() {
pub fn test_dlist_append_self() {
let a = DList::<int>();
a.append(a);
}
#[test]
#[ignore(cfg(windows))]
#[should_fail]
fn test_dlist_prepend_self() {
pub fn test_dlist_prepend_self() {
let a = DList::<int>();
a.prepend(a);
}
#[test]
fn test_dlist_prepend() {
pub fn test_dlist_prepend() {
let a = from_vec(~[1,2,3]);
let b = from_vec(~[4,5,6]);
b.prepend(a);
@ -598,7 +596,7 @@ mod tests {
b.assert_consistent(); assert b.is_empty();
}
#[test]
fn test_dlist_reverse() {
pub fn test_dlist_reverse() {
let a = from_vec(~[5,4,3,2,1]);
a.reverse();
assert a.len() == 5;
@ -610,14 +608,14 @@ mod tests {
a.assert_consistent(); assert a.is_empty();
}
#[test]
fn test_dlist_reverse_empty() {
pub fn test_dlist_reverse_empty() {
let a = DList::<int>();
a.reverse();
assert a.len() == 0;
a.assert_consistent();
}
#[test]
fn test_dlist_each_node() {
pub fn test_dlist_each_node() {
let a = from_vec(~[1,2,4,5]);
for a.each_node |nobe| {
if nobe.data > 3 {
@ -634,28 +632,28 @@ mod tests {
a.assert_consistent(); assert a.is_empty();
}
#[test]
fn test_dlist_clear() {
pub fn test_dlist_clear() {
let a = from_vec(~[5,4,3,2,1]);
a.clear();
assert a.len() == 0;
a.assert_consistent();
}
#[test]
fn test_dlist_is_empty() {
pub fn test_dlist_is_empty() {
let empty = DList::<int>();
let full1 = from_vec(~[1,2,3]);
assert empty.is_empty();
assert !full1.is_empty();
}
#[test]
fn test_dlist_head_tail() {
pub fn test_dlist_head_tail() {
let l = from_vec(~[1,2,3]);
assert l.head() == 1;
assert l.tail() == 3;
assert l.len() == 3;
}
#[test]
fn test_dlist_pop() {
pub fn test_dlist_pop() {
let l = from_vec(~[1,2,3]);
assert l.pop().get() == 1;
assert l.tail() == 3;
@ -668,7 +666,7 @@ mod tests {
assert l.pop().is_none();
}
#[test]
fn test_dlist_pop_tail() {
pub fn test_dlist_pop_tail() {
let l = from_vec(~[1,2,3]);
assert l.pop_tail().get() == 3;
assert l.tail() == 2;
@ -681,7 +679,7 @@ mod tests {
assert l.pop_tail().is_none();
}
#[test]
fn test_dlist_push() {
pub fn test_dlist_push() {
let l = DList::<int>();
l.push(1);
assert l.head() == 1;
@ -695,7 +693,7 @@ mod tests {
assert l.len() == 3;
}
#[test]
fn test_dlist_push_head() {
pub fn test_dlist_push_head() {
let l = DList::<int>();
l.push_head(3);
assert l.head() == 3;
@ -709,12 +707,12 @@ mod tests {
assert l.len() == 3;
}
#[test]
fn test_dlist_foldl() {
pub fn test_dlist_foldl() {
let l = from_vec(vec::from_fn(101, |x|x));
assert iter::foldl(&l, 0, |accum,elem| *accum+*elem) == 5050;
}
#[test]
fn test_dlist_break_early() {
pub fn test_dlist_break_early() {
let l = from_vec(~[1,2,3,4,5]);
let mut x = 0;
for l.each |i| {
@ -724,7 +722,7 @@ mod tests {
assert x == 3;
}
#[test]
fn test_dlist_remove_head() {
pub fn test_dlist_remove_head() {
let l = DList::<int>();
l.assert_consistent(); let one = l.push_n(1);
l.assert_consistent(); let _two = l.push_n(2);
@ -739,7 +737,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_remove_mid() {
pub fn test_dlist_remove_mid() {
let l = DList::<int>();
l.assert_consistent(); let _one = l.push_n(1);
l.assert_consistent(); let two = l.push_n(2);
@ -754,7 +752,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_remove_tail() {
pub fn test_dlist_remove_tail() {
let l = DList::<int>();
l.assert_consistent(); let _one = l.push_n(1);
l.assert_consistent(); let _two = l.push_n(2);
@ -769,7 +767,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_remove_one_two() {
pub fn test_dlist_remove_one_two() {
let l = DList::<int>();
l.assert_consistent(); let one = l.push_n(1);
l.assert_consistent(); let two = l.push_n(2);
@ -785,7 +783,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_remove_one_three() {
pub fn test_dlist_remove_one_three() {
let l = DList::<int>();
l.assert_consistent(); let one = l.push_n(1);
l.assert_consistent(); let _two = l.push_n(2);
@ -800,7 +798,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_remove_two_three() {
pub fn test_dlist_remove_two_three() {
let l = DList::<int>();
l.assert_consistent(); let _one = l.push_n(1);
l.assert_consistent(); let two = l.push_n(2);
@ -815,7 +813,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_remove_all() {
pub fn test_dlist_remove_all() {
let l = DList::<int>();
l.assert_consistent(); let one = l.push_n(1);
l.assert_consistent(); let two = l.push_n(2);
@ -828,7 +826,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_insert_n_before() {
pub fn test_dlist_insert_n_before() {
let l = DList::<int>();
l.assert_consistent(); let _one = l.push_n(1);
l.assert_consistent(); let two = l.push_n(2);
@ -844,7 +842,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_insert_n_after() {
pub fn test_dlist_insert_n_after() {
let l = DList::<int>();
l.assert_consistent(); let one = l.push_n(1);
l.assert_consistent(); let _two = l.push_n(2);
@ -860,7 +858,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_insert_before_head() {
pub fn test_dlist_insert_before_head() {
let l = DList::<int>();
l.assert_consistent(); let one = l.push_n(1);
l.assert_consistent(); let _two = l.push_n(2);
@ -875,7 +873,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test]
fn test_dlist_insert_after_tail() {
pub fn test_dlist_insert_after_tail() {
let l = DList::<int>();
l.assert_consistent(); let _one = l.push_n(1);
l.assert_consistent(); let two = l.push_n(2);
@ -890,7 +888,7 @@ mod tests {
l.assert_consistent(); assert l.is_empty();
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_dlist_asymmetric_link() {
pub fn test_dlist_asymmetric_link() {
let l = DList::<int>();
let _one = l.push_n(1);
let two = l.push_n(2);
@ -898,7 +896,7 @@ mod tests {
l.assert_consistent();
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_dlist_cyclic_list() {
pub fn test_dlist_cyclic_list() {
let l = DList::<int>();
let one = l.push_n(1);
let _two = l.push_n(2);
@ -908,32 +906,32 @@ mod tests {
l.assert_consistent();
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_dlist_headless() {
pub fn test_dlist_headless() {
DList::<int>().head();
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_dlist_insert_already_present_before() {
pub fn test_dlist_insert_already_present_before() {
let l = DList::<int>();
let one = l.push_n(1);
let two = l.push_n(2);
l.insert_n_before(two, one);
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_dlist_insert_already_present_after() {
pub fn test_dlist_insert_already_present_after() {
let l = DList::<int>();
let one = l.push_n(1);
let two = l.push_n(2);
l.insert_n_after(one, two);
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_dlist_insert_before_orphan() {
pub fn test_dlist_insert_before_orphan() {
let l = DList::<int>();
let one = new_dlist_node(1);
let two = new_dlist_node(2);
l.insert_n_before(one, two);
}
#[test] #[should_fail] #[ignore(cfg(windows))]
fn test_dlist_insert_after_orphan() {
pub fn test_dlist_insert_after_orphan() {
let l = DList::<int>();
let one = new_dlist_node(1);
let two = new_dlist_node(2);

View File

@ -62,16 +62,15 @@ struct StackSegment {
}
extern mod rustrt {
#[legacy_exports];
#[rust_stack]
unsafe fn rust_call_tydesc_glue(root: *Word,
tydesc: *Word,
field: size_t);
pub unsafe fn rust_call_tydesc_glue(root: *Word,
tydesc: *Word,
field: size_t);
#[rust_stack]
unsafe fn rust_gc_metadata() -> *Word;
pub unsafe fn rust_gc_metadata() -> *Word;
unsafe fn rust_get_stack_segment() -> *StackSegment;
pub unsafe fn rust_get_stack_segment() -> *StackSegment;
}
unsafe fn bump<T, U>(ptr: *T, count: uint) -> *U {

View File

@ -37,15 +37,13 @@ pub mod finally;
pub mod weak_task;
extern mod rustrt {
#[legacy_exports];
pub unsafe fn rust_create_little_lock() -> rust_little_lock;
pub unsafe fn rust_destroy_little_lock(lock: rust_little_lock);
pub unsafe fn rust_lock_little_lock(lock: rust_little_lock);
pub unsafe fn rust_unlock_little_lock(lock: rust_little_lock);
unsafe fn rust_create_little_lock() -> rust_little_lock;
unsafe fn rust_destroy_little_lock(lock: rust_little_lock);
unsafe fn rust_lock_little_lock(lock: rust_little_lock);
unsafe fn rust_unlock_little_lock(lock: rust_little_lock);
unsafe fn rust_raw_thread_start(f: &fn()) -> *raw_thread;
unsafe fn rust_raw_thread_join_delete(thread: *raw_thread);
pub unsafe fn rust_raw_thread_start(f: &fn()) -> *raw_thread;
pub unsafe fn rust_raw_thread_join_delete(thread: *raw_thread);
}
#[abi = "rust-intrinsic"]

View File

@ -398,31 +398,29 @@ pub pure fn unwrap_err<T, U>(res: Result<T, U>) -> U {
#[cfg(test)]
#[allow(non_implicitly_copyable_typarams)]
mod tests {
#[legacy_exports];
use result::{Err, Ok, Result, chain, get, get_err};
use result;
fn op1() -> result::Result<int, ~str> { result::Ok(666) }
pub fn op1() -> result::Result<int, ~str> { result::Ok(666) }
fn op2(i: int) -> result::Result<uint, ~str> {
pub fn op2(i: int) -> result::Result<uint, ~str> {
result::Ok(i as uint + 1u)
}
fn op3() -> result::Result<int, ~str> { result::Err(~"sadface") }
pub fn op3() -> result::Result<int, ~str> { result::Err(~"sadface") }
#[test]
fn chain_success() {
pub fn chain_success() {
assert get(&chain(op1(), op2)) == 667u;
}
#[test]
fn chain_failure() {
pub fn chain_failure() {
assert get_err(&chain(op3(), op2)) == ~"sadface";
}
#[test]
fn test_impl_iter() {
pub fn test_impl_iter() {
let mut valid = false;
Ok::<~str, ~str>(~"a").iter(|_x| valid = true);
assert valid;
@ -432,7 +430,7 @@ mod tests {
}
#[test]
fn test_impl_iter_err() {
pub fn test_impl_iter_err() {
let mut valid = true;
Ok::<~str, ~str>(~"a").iter_err(|_x| valid = false);
assert valid;
@ -443,19 +441,19 @@ mod tests {
}
#[test]
fn test_impl_map() {
pub fn test_impl_map() {
assert Ok::<~str, ~str>(~"a").map(|_x| ~"b") == Ok(~"b");
assert Err::<~str, ~str>(~"a").map(|_x| ~"b") == Err(~"a");
}
#[test]
fn test_impl_map_err() {
pub fn test_impl_map_err() {
assert Ok::<~str, ~str>(~"a").map_err(|_x| ~"b") == Ok(~"a");
assert Err::<~str, ~str>(~"a").map_err(|_x| ~"b") == Err(~"b");
}
#[test]
fn test_get_ref_method() {
pub fn test_get_ref_method() {
let foo: Result<int, ()> = Ok(100);
assert *foo.get_ref() == 100;
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[legacy_exports];
// NB: transitionary, de-mode-ing.
#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
@ -27,11 +25,11 @@ use gc::{cleanup_stack_for_failure, gc, Word};
pub type rust_task = c_void;
#[cfg(target_word_size = "32")]
const FROZEN_BIT: uint = 0x80000000;
pub const FROZEN_BIT: uint = 0x80000000;
#[cfg(target_word_size = "64")]
const FROZEN_BIT: uint = 0x8000000000000000;
pub const FROZEN_BIT: uint = 0x8000000000000000;
extern mod rustrt {
pub extern mod rustrt {
#[rust_stack]
unsafe fn rust_upcall_exchange_malloc(td: *c_char, size: uintptr_t)
-> *c_char;

View File

@ -97,12 +97,10 @@ fn frame_address(f: fn(++x: *u8)) {
}
extern mod rustrt {
#[legacy_exports];
unsafe fn rust_dbg_breakpoint();
pub unsafe fn rust_dbg_breakpoint();
}
#[abi = "rust-intrinsic"]
extern mod rusti {
#[legacy_exports];
fn frame_address(f: &once fn(++x: *u8));
pub fn frame_address(f: &once fn(++x: *u8));
}

View File

@ -2574,7 +2574,6 @@ pub mod general_category {
}
mod derived_property {
#[legacy_exports];
/// Check if a character has the alphabetic unicode property
pub pure fn Alphabetic(c: char) -> bool {
return match c {
@ -4690,5 +4689,5 @@ mod derived_property {
_ => false
};
}
}

View File

@ -104,13 +104,11 @@ pub fn unreachable() -> ! {
}
mod tests {
#[legacy_exports];
use option::{None, Some};
use util::{NonCopyable, id, replace, swap};
#[test]
fn identity_crisis() {
pub fn identity_crisis() {
// Writing a test for the identity function. How did it come to this?
let x = ~[(5, false)];
//FIXME #3387 assert x.eq(id(copy x));
@ -118,7 +116,7 @@ mod tests {
assert x.eq(&id(move y));
}
#[test]
fn test_swap() {
pub fn test_swap() {
let mut x = 31337;
let mut y = 42;
swap(&mut x, &mut y);
@ -126,7 +124,7 @@ mod tests {
assert y == 31337;
}
#[test]
fn test_replace() {
pub fn test_replace() {
let mut x = Some(NonCopyable());
let y = replace(&mut x, None);
assert x.is_none();