Skip to content

Commit

Permalink
auto merge of #6441 : alexcrichton/rust/issue-5531, r=luqmana
Browse files Browse the repository at this point in the history
Also fix up all the fallout elsewhere throughout core. It's really nice being
able to have the prelude.

I'm not quite sure how resolution works with traits, but it seems to me like the public imports at the top-level of the core crate were leaking into the sub-crates, but that could also be working as intended. Regardless, things compile without the re-exports now.
  • Loading branch information
bors committed May 14, 2013
2 parents 3aa1122 + 66e1e51 commit 5a2f65f
Show file tree
Hide file tree
Showing 34 changed files with 81 additions and 80 deletions.
2 changes: 2 additions & 0 deletions src/libcore/at_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -577,7 +578,7 @@ impl<T:Owned,
#[cfg(test)]
mod test {
use either::Right;
use super::{Chan, Port, oneshot, recv_one, stream};
use super::{Chan, Port, oneshot, stream};
#[test]
fn test_select2() {
Expand Down
42 changes: 0 additions & 42 deletions src/libcore/core.rc
Original file line number Diff line number Diff line change
Expand Up @@ -68,48 +68,6 @@ they contained the following prologue:
#[cfg(test)] pub use ops = realcore::ops;
#[cfg(test)] pub use cmp = realcore::cmp;

/* Reexported core operators */

pub use kinds::{Const, Copy, Owned};
pub use ops::{Drop};
pub use ops::{Add, Sub, Mul, Div, Rem, Neg, Not};
pub use ops::{BitAnd, BitOr, BitXor};
pub use ops::{Shl, Shr, Index};


/* Reexported types and traits */

pub use option::{Option, Some, None};
pub use result::{Result, Ok, Err};

pub use path::Path;
pub use path::GenericPath;
pub use path::WindowsPath;
pub use path::PosixPath;

pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
pub use str::{StrSlice};
pub use container::{Container, Mutable};
pub use vec::{CopyableVector, ImmutableVector};
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
pub use vec::{OwnedVector, OwnedCopyableVector, MutableVector};
pub use old_iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
pub use old_iter::{CopyableOrderedIter, CopyableNonstrictIter};
pub use old_iter::{ExtendedMutableIter};
pub use iter::Times;

pub use num::{Num, NumCast};
pub use num::{Orderable, Signed, Unsigned, Round};
pub use num::{Algebraic, Trigonometric, Exponential, Hyperbolic};
pub use num::{Integer, Fractional, Real, RealExt};
pub use num::{Bitwise, BitCount, Bounded};
pub use num::{Primitive, Int, Float};

pub use ptr::Ptr;
pub use from_str::FromStr;
pub use to_str::ToStr;
pub use clone::Clone;

// On Linux, link to the runtime with -lrt.
#[cfg(target_os = "linux")]
#[doc(hidden)]
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@

//! A type that represents one of two alternatives
use container::Container;
use cmp::Eq;
use kinds::Copy;
use old_iter::BaseIter;
use result::Result;
use result;
use vec;
use vec::OwnedVector;

/// The either type
#[deriving(Clone, Eq)]
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#[cfg(stage0)]
use cast;
use container::Container;
use old_iter::BaseIter;
use rt::io::Writer;
use to_bytes::IterBytes;
use uint;
Expand Down
5 changes: 5 additions & 0 deletions src/libcore/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Basic input/output

use result::Result;

use container::Container;
use int;
use libc;
use libc::{c_int, c_long, c_void, size_t, ssize_t};
Expand All @@ -24,11 +25,15 @@ use os;
use cast;
use path::Path;
use ops::Drop;
use old_iter::{BaseIter, CopyableIter};
use ptr;
use result;
use str;
use str::StrSlice;
use to_str::ToStr;
use uint;
use vec;
use vec::{OwnedVector, OwnedCopyableVector};

#[allow(non_camel_case_types)] // not sure what to do about this
pub type fd_t = c_int;
Expand Down
1 change: 1 addition & 0 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ much easier to implement.

#[cfg(not(stage0))] use cmp::Ord;
#[cfg(not(stage0))] use option::{Option, Some, None};
#[cfg(not(stage0))] use vec::OwnedVector;

#[cfg(stage0)]
pub trait Times {
Expand Down
1 change: 1 addition & 0 deletions src/libcore/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub fn console_off() {
#[cfg(not(test))]
#[lang="log_type"]
pub fn log_type<T>(level: u32, object: &T) {
use container::Container;
use cast::transmute;
use io;
use libc;
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/num/strconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
// 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};
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;

Expand Down
1 change: 1 addition & 0 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 4 additions & 0 deletions src/libcore/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 1 addition & 0 deletions src/libcore/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#[doc(hidden)];

use libc::c_char;
use ptr::Ptr;

#[path = "sched/mod.rs"]
mod sched;
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/rt/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/rt/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/rt/uv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/rt/uv/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/libcore/rt/uvio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/rt/work_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
priv queue: ~[T]
Expand Down
1 change: 0 additions & 1 deletion src/libcore/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
12 changes: 10 additions & 2 deletions src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -3133,13 +3138,16 @@ impl<'self> Iterator<char> 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]
Expand Down
3 changes: 3 additions & 0 deletions src/libcore/str/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
};
Expand Down
1 change: 0 additions & 1 deletion src/libcore/task/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
Loading

0 comments on commit 5a2f65f

Please sign in to comment.