From 66e1e517019c70450dcadeb0d876c686729215e3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 12 May 2013 20:34:15 -0400 Subject: [PATCH] Remove re-exports from libcore/core.rc Also fix up all the fallout elsewhere throughout core. It's really nice being able to have the prelude. --- src/libcore/at_vec.rs | 2 + src/libcore/comm.rs | 5 ++- src/libcore/core.rc | 42 ------------------- src/libcore/either.rs | 3 ++ src/libcore/hash.rs | 2 + src/libcore/io.rs | 5 +++ src/libcore/iter.rs | 1 + src/libcore/logging.rs | 1 + src/libcore/num/strconv.rs | 3 ++ src/libcore/option.rs | 1 + src/libcore/path.rs | 4 ++ src/libcore/pipes.rs | 3 ++ src/libcore/ptr.rs | 2 +- src/libcore/repr.rs | 3 +- src/libcore/result.rs | 2 + src/libcore/rt/mod.rs | 1 + src/libcore/rt/stack.rs | 2 + src/libcore/rt/test.rs | 2 +- src/libcore/rt/uv/mod.rs | 2 + src/libcore/rt/uv/net.rs | 2 +- src/libcore/rt/uvio.rs | 4 +- src/libcore/rt/work_queue.rs | 2 + src/libcore/run.rs | 1 - src/libcore/str.rs | 12 +++++- src/libcore/str/ascii.rs | 3 ++ src/libcore/task/mod.rs | 2 +- src/libcore/task/spawn.rs | 1 - src/libcore/to_bytes.rs | 1 + src/libcore/to_str.rs | 3 +- src/libcore/unstable/global.rs | 12 +----- src/libcore/unstable/weak_task.rs | 2 +- src/libcore/vec.rs | 22 +++++----- src/librustc/util/enum_set.rs | 6 +-- .../tag-that-dare-not-speak-its-name.rs | 2 +- 34 files changed, 81 insertions(+), 80 deletions(-) diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index a3981dd84913b..d0f9a4ff90f1e 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -11,8 +11,10 @@ //! Managed vectors use cast::transmute; +use container::Container; use kinds::Copy; use old_iter; +use old_iter::BaseIter; use option::Option; use sys; use uint; diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index 322584f8df174..f4eb856865d07 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -13,12 +13,13 @@ Message passing */ use cast::{transmute, transmute_mut}; +use container::Container; use either::{Either, Left, Right}; use kinds::Owned; use option::{Option, Some, None}; use uint; -use unstable; use vec; +use vec::OwnedVector; use util::replace; use unstable::sync::{Exclusive, exclusive}; @@ -577,7 +578,7 @@ impl(level: u32, object: &T) { + use container::Container; use cast::transmute; use io; use libc; diff --git a/src/libcore/num/strconv.rs b/src/libcore/num/strconv.rs index 052246a7744ce..5ed99a8399559 100644 --- a/src/libcore/num/strconv.rs +++ b/src/libcore/num/strconv.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use container::Container; use core::cmp::{Ord, Eq}; use ops::{Add, Sub, Mul, Div, Rem, Neg}; use option::{None, Option, Some}; @@ -15,6 +16,8 @@ use char; use str; use kinds::Copy; use vec; +use vec::{CopyableVector, ImmutableVector}; +use vec::OwnedVector; use num::{NumCast, Zero, One, cast, pow_with_uint}; use f64; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 7cb408767058c..e171552af4c74 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -48,6 +48,7 @@ use util; use num::Zero; use old_iter::{BaseIter, MutableIter, ExtendedIter}; use old_iter; +use str::StrSlice; #[cfg(test)] use str; diff --git a/src/libcore/path.rs b/src/libcore/path.rs index c6c164c2728fa..2015c5474be32 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -14,12 +14,16 @@ Cross-platform file path handling */ +use container::Container; use cmp::Eq; use libc; use option::{None, Option, Some}; use str; +use str::StrSlice; use to_str::ToStr; use ascii::{AsciiCast, AsciiStr}; +use old_iter::BaseIter; +use vec::OwnedVector; #[cfg(windows)] pub use Path = self::WindowsPath; diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 9b664b334ba36..fb80a43347e01 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -82,6 +82,7 @@ bounded and unbounded protocols allows for less code duplication. */ +use container::Container; use cast::{forget, transmute, transmute_copy}; use either::{Either, Left, Right}; use kinds::Owned; @@ -91,8 +92,10 @@ use option::{None, Option, Some}; use unstable::finally::Finally; use unstable::intrinsics; use ptr; +use ptr::Ptr; use task; use vec; +use vec::OwnedVector; use util::replace; static SPIN_COUNT: uint = 0; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 77e4143d090f5..0aff6e06e69bd 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -353,7 +353,7 @@ pub mod ptr_tests { assert!((p.fst == 50)); assert!((p.snd == 60)); - let mut v0 = ~[32000u16, 32001u16, 32002u16]; + let v0 = ~[32000u16, 32001u16, 32002u16]; let mut v1 = ~[0u16, 0u16, 0u16]; copy_memory(mut_offset(vec::raw::to_mut_ptr(v1), 1u), diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index a645a7e868076..0bf8635d1c8f3 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -25,10 +25,11 @@ use managed; use ptr; use reflect; use reflect::{MovePtr, align}; +use str::StrSlice; use to_str::ToStr; -use vec::UnboxedVecRepr; use vec::raw::{VecRepr, SliceRepr}; use vec; +use vec::{OwnedVector, UnboxedVecRepr}; #[cfg(test)] use io; diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 1d67e754a4f24..b7de667878399 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -17,7 +17,9 @@ use either; use either::Either; use kinds::Copy; use option::{None, Option, Some}; +use old_iter::BaseIter; use vec; +use vec::OwnedVector; /// The result type #[deriving(Clone, Eq)] diff --git a/src/libcore/rt/mod.rs b/src/libcore/rt/mod.rs index 25f6c870654a6..fbbc82743407c 100644 --- a/src/libcore/rt/mod.rs +++ b/src/libcore/rt/mod.rs @@ -13,6 +13,7 @@ #[doc(hidden)]; use libc::c_char; +use ptr::Ptr; #[path = "sched/mod.rs"] mod sched; diff --git a/src/libcore/rt/stack.rs b/src/libcore/rt/stack.rs index 9eca3bda0473c..3a4e9307d3b50 100644 --- a/src/libcore/rt/stack.rs +++ b/src/libcore/rt/stack.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use container::Container; +use ptr::Ptr; use vec; pub struct StackSegment { diff --git a/src/libcore/rt/test.rs b/src/libcore/rt/test.rs index 63db705408800..0c6843c605d15 100644 --- a/src/libcore/rt/test.rs +++ b/src/libcore/rt/test.rs @@ -77,7 +77,7 @@ pub fn spawntask_try(f: ~fn()) -> Result<(), ()> { // Switch to the scheduler let f = Cell(Cell(f)); - let mut sched = local_sched::take(); + let sched = local_sched::take(); do sched.deschedule_running_task_and_then() |old_task| { let old_task = Cell(old_task); let f = f.take(); diff --git a/src/libcore/rt/uv/mod.rs b/src/libcore/rt/uv/mod.rs index 013a28abf2813..6499f0a3efdcf 100644 --- a/src/libcore/rt/uv/mod.rs +++ b/src/libcore/rt/uv/mod.rs @@ -34,11 +34,13 @@ via `close` and `delete` methods. */ +use container::Container; use option::*; use str::raw::from_c_str; use to_str::ToStr; use vec; use ptr; +use ptr::Ptr; use libc::{c_void, c_int, size_t, malloc, free}; use cast::transmute; use ptr::null; diff --git a/src/libcore/rt/uv/net.rs b/src/libcore/rt/uv/net.rs index 376231e3b27c5..3e6aa657c57dd 100644 --- a/src/libcore/rt/uv/net.rs +++ b/src/libcore/rt/uv/net.rs @@ -388,7 +388,7 @@ fn listen() { assert!(status.is_none()); let mut server_stream_watcher = server_stream_watcher; let mut loop_ = loop_; - let mut client_tcp_watcher = TcpWatcher::new(&mut loop_); + let client_tcp_watcher = TcpWatcher::new(&mut loop_); let mut client_tcp_watcher = client_tcp_watcher.as_stream(); server_stream_watcher.accept(client_tcp_watcher); let count_cell = Cell(0); diff --git a/src/libcore/rt/uvio.rs b/src/libcore/rt/uvio.rs index 8f1a6ea0d34c1..24bffd8d1cd24 100644 --- a/src/libcore/rt/uvio.rs +++ b/src/libcore/rt/uvio.rs @@ -15,10 +15,12 @@ use super::io::net::ip::IpAddr; use super::uv::*; use super::rtio::*; use ops::Drop; +use old_iter::CopyableIter; use cell::{Cell, empty_cell}; use cast::transmute; use super::sched::{Scheduler, local_sched}; +#[cfg(test)] use container::Container; #[cfg(test)] use uint; #[cfg(test)] use unstable::run_in_bare_thread; #[cfg(test)] use super::test::*; @@ -426,7 +428,7 @@ fn test_read_read_read() { let io = local_sched::unsafe_borrow_io(); let mut listener = io.bind(addr).unwrap(); let mut stream = listener.listen().unwrap(); - let mut buf = [1, .. 2048]; + let buf = [1, .. 2048]; let mut total_bytes_written = 0; while total_bytes_written < MAX { stream.write(buf); diff --git a/src/libcore/rt/work_queue.rs b/src/libcore/rt/work_queue.rs index dfa88b783c59f..495cd75a0bf8e 100644 --- a/src/libcore/rt/work_queue.rs +++ b/src/libcore/rt/work_queue.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use container::Container; use option::*; +use vec::OwnedVector; pub struct WorkQueue { priv queue: ~[T] diff --git a/src/libcore/run.rs b/src/libcore/run.rs index fd168dc02f606..c865e77cc6b78 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -778,7 +778,6 @@ pub fn waitpid(pid: pid_t) -> int { #[cfg(test)] mod tests { - use libc; use option::None; use os; use run::{readclose, writeclose}; diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 3e2116dda0d11..d31152e1e1c66 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -23,14 +23,19 @@ use cast; use char; use clone::Clone; use cmp::{TotalOrd, Ordering, Less, Equal, Greater}; +use container::Container; +use iter::Times; +use iterator::Iterator; use libc; use option::{None, Option, Some}; -use iterator::Iterator; +use old_iter::{BaseIter, EqIter}; use ptr; +use ptr::Ptr; use str; +use to_str::ToStr; use uint; use vec; -use to_str::ToStr; +use vec::{OwnedVector, OwnedCopyableVector}; #[cfg(not(test))] use cmp::{Eq, Ord, Equiv, TotalEq}; @@ -3133,13 +3138,16 @@ impl<'self> Iterator for StrCharIterator<'self> { #[cfg(test)] mod tests { + use container::Container; use char; use option::Some; use libc::c_char; use libc; + use old_iter::BaseIter; use ptr; use str::*; use vec; + use vec::ImmutableVector; use cmp::{TotalOrd, Less, Equal, Greater}; #[test] diff --git a/src/libcore/str/ascii.rs b/src/libcore/str/ascii.rs index 73f556518fa66..4e239c4c82c7d 100644 --- a/src/libcore/str/ascii.rs +++ b/src/libcore/str/ascii.rs @@ -12,7 +12,10 @@ use to_str::{ToStr,ToStrConsume}; use str; +use str::StrSlice; use cast; +use old_iter::BaseIter; +use vec::{CopyableVector, ImmutableVector, OwnedVector}; /// Datatype to hold one ascii character. It is 8 bit long. #[deriving(Clone, Eq)] diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 2484d8c5feda4..1518f80a125a9 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -772,7 +772,7 @@ fn test_add_wrapper() { do b0.add_wrapper |body| { let ch = Cell(ch.take()); let result: ~fn() = || { - let mut ch = ch.take(); + let ch = ch.take(); body(); ch.send(()); }; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 545f1ac8adaa8..9a1689ca05614 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -78,7 +78,6 @@ use cell::Cell; use container::Map; use comm::{Chan, GenericChan}; use prelude::*; -use unstable; use ptr; use hashmap::HashSet; use task::local_data_priv::{local_get, local_set, OldHandle}; diff --git a/src/libcore/to_bytes.rs b/src/libcore/to_bytes.rs index 182a03da4b1c6..6cc621e3419ad 100644 --- a/src/libcore/to_bytes.rs +++ b/src/libcore/to_bytes.rs @@ -17,6 +17,7 @@ The `ToBytes` and `IterBytes` traits use io; use io::Writer; use option::{None, Option, Some}; +use old_iter::BaseIter; use str; pub type Cb<'self> = &'self fn(buf: &[u8]) -> bool; diff --git a/src/libcore/to_str.rs b/src/libcore/to_str.rs index 58a9f768644bd..365cb847740b2 100644 --- a/src/libcore/to_str.rs +++ b/src/libcore/to_str.rs @@ -20,6 +20,7 @@ use hashmap::HashSet; use container::Map; use hash::Hash; use cmp::Eq; +use old_iter::BaseIter; pub trait ToStr { fn to_str(&self) -> ~str; @@ -236,4 +237,4 @@ mod tests { assert!(set_str == ~"{1, 2}" || set_str == ~"{2, 1}"); assert!(empty_set.to_str() == ~"{}"); } -} \ No newline at end of file +} diff --git a/src/libcore/unstable/global.rs b/src/libcore/unstable/global.rs index 2d6698fb96ade..88433f9cefe51 100644 --- a/src/libcore/unstable/global.rs +++ b/src/libcore/unstable/global.rs @@ -255,11 +255,7 @@ fn test_modify() { unsafe { do global_data_modify(key) |v| { match v { - None => { - unsafe { - Some(~UnsafeAtomicRcBox::new(10)) - } - } + None => { Some(~UnsafeAtomicRcBox::new(10)) } _ => fail!() } } @@ -277,11 +273,7 @@ fn test_modify() { do global_data_modify(key) |v| { match v { - None => { - unsafe { - Some(~UnsafeAtomicRcBox::new(10)) - } - } + None => { Some(~UnsafeAtomicRcBox::new(10)) } _ => fail!() } } diff --git a/src/libcore/unstable/weak_task.rs b/src/libcore/unstable/weak_task.rs index 8670bcfcd9a05..d5c5230cef819 100644 --- a/src/libcore/unstable/weak_task.rs +++ b/src/libcore/unstable/weak_task.rs @@ -191,7 +191,7 @@ fn test_select_stream_and_oneshot() { use comm::select2i; use either::{Left, Right}; - let mut (port, chan) = stream(); + let (port, chan) = stream(); let port = Cell(port); let (waitport, waitchan) = stream(); do spawn { diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index e56144ebc0a3b..3a6bbf5c860a6 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -22,9 +22,11 @@ use old_iter; use iterator::Iterator; use kinds::Copy; use libc; +use old_iter::{BaseIter, CopyableIter}; use option::{None, Option, Some}; use ptr::to_unsafe_ptr; use ptr; +use ptr::Ptr; use sys; use uint; use unstable::intrinsics; @@ -3565,7 +3567,7 @@ mod tests { fn sub(a: int, b: &int) -> int { a - *b } - let mut v = ~[1, 2, 3, 4]; + let v = ~[1, 2, 3, 4]; let sum = foldl(0, v, sub); assert!(sum == -10); } @@ -3575,7 +3577,7 @@ mod tests { fn sub(a: &int, b: int) -> int { *a - b } - let mut v = ~[1, 2, 3, 4]; + let v = ~[1, 2, 3, 4]; let sum = foldr(v, 0, sub); assert!(sum == -2); } @@ -3739,7 +3741,7 @@ mod tests { assert!(position_between(~[], 0u, 0u, f).is_none()); fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } - let mut v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert!(position_between(v, 0u, 0u, f).is_none()); assert!(position_between(v, 0u, 1u, f).is_none()); @@ -3768,7 +3770,7 @@ mod tests { fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } fn g(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'd' } - let mut v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert!(find(v, f) == Some((1, 'b'))); assert!(find(v, g).is_none()); @@ -3779,7 +3781,7 @@ mod tests { assert!(find_between(~[], 0u, 0u, f).is_none()); fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } - let mut v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert!(find_between(v, 0u, 0u, f).is_none()); assert!(find_between(v, 0u, 1u, f).is_none()); @@ -3808,7 +3810,7 @@ mod tests { fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } fn g(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'd' } - let mut v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert!(position(v, f) == Some(1u)); assert!(position(v, g).is_none()); @@ -3819,7 +3821,7 @@ mod tests { assert!(rposition_between(~[], 0u, 0u, f).is_none()); fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } - let mut v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert!(rposition_between(v, 0u, 0u, f).is_none()); assert!(rposition_between(v, 0u, 1u, f).is_none()); @@ -3848,7 +3850,7 @@ mod tests { fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } fn g(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'd' } - let mut v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert!(rfind(v, f) == Some((3, 'b'))); assert!(rfind(v, g).is_none()); @@ -3859,7 +3861,7 @@ mod tests { assert!(rfind_between(~[], 0u, 0u, f).is_none()); fn f(xy: &(int, char)) -> bool { let (_x, y) = *xy; y == 'b' } - let mut v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; + let v = ~[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')]; assert!(rfind_between(v, 0u, 0u, f).is_none()); assert!(rfind_between(v, 0u, 1u, f).is_none()); @@ -4328,7 +4330,7 @@ mod tests { #[ignore(windows)] #[should_fail] fn test_map_fail() { - let mut v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; + let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; let mut i = 0; do map(v) |_elt| { if i == 2 { diff --git a/src/librustc/util/enum_set.rs b/src/librustc/util/enum_set.rs index c589ab5287421..8c4cbd0bce586 100644 --- a/src/librustc/util/enum_set.rs +++ b/src/librustc/util/enum_set.rs @@ -82,19 +82,19 @@ pub impl EnumSet { } } -impl core::Sub, EnumSet> for EnumSet { +impl Sub, EnumSet> for EnumSet { fn sub(&self, e: &EnumSet) -> EnumSet { EnumSet {bits: self.bits & !e.bits} } } -impl core::BitOr, EnumSet> for EnumSet { +impl BitOr, EnumSet> for EnumSet { fn bitor(&self, e: &EnumSet) -> EnumSet { EnumSet {bits: self.bits | e.bits} } } -impl core::BitAnd, EnumSet> for EnumSet { +impl BitAnd, EnumSet> for EnumSet { fn bitand(&self, e: &EnumSet) -> EnumSet { EnumSet {bits: self.bits & e.bits} } diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs index af99c0e5f2953..22f6a34a181fb 100644 --- a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs +++ b/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs @@ -15,7 +15,7 @@ extern mod core; -fn last(v: ~[&T]) -> core::Option { +fn last(v: ~[&T]) -> core::option::Option { fail!(); }