diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-07 08:20:22 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-07 11:03:12 -0700 |
| commit | 07caa224501817c93be3f5c57a013ed5db6c04e1 (patch) | |
| tree | 4a7df32c0c34f78282e842b308c2751f3d3cd5ee /src/libstd | |
| parent | a289ebefb8c3584d91484f0bb62f696dffadda02 (diff) | |
| download | rust-07caa224501817c93be3f5c57a013ed5db6c04e1.tar.gz rust-07caa224501817c93be3f5c57a013ed5db6c04e1.zip | |
Test fixes and rebase conflicts
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/comm/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 7 | ||||
| -rw-r--r-- | src/libstd/option.rs | 10 | ||||
| -rw-r--r-- | src/libstd/os.rs | 8 | ||||
| -rw-r--r-- | src/libstd/owned.rs | 33 | ||||
| -rw-r--r-- | src/libstd/repr.rs | 1 | ||||
| -rw-r--r-- | src/libstd/slice.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sync/mpmc_bounded_queue.rs | 1 |
8 files changed, 12 insertions, 51 deletions
diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index bd1def518f0..df0c6f3b8d3 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -981,7 +981,6 @@ mod test { use native; use os; - use owned::Box; use super::*; pub fn stress_factor() -> uint { @@ -1516,7 +1515,6 @@ mod test { mod sync_tests { use prelude::*; use os; - use owned::Box; pub fn stress_factor() -> uint { match os::getenv("RUST_TEST_STRESS") { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index abcc1f099b4..72d41ae1dd2 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -133,9 +133,10 @@ extern crate core; #[cfg(test)] pub use ty = realstd::ty; #[cfg(test)] pub use owned = realstd::owned; +#[cfg(not(test))] pub use cmp = core::cmp; #[cfg(not(test))] pub use kinds = core::kinds; #[cfg(not(test))] pub use ops = core::ops; -#[cfg(not(test))] pub use cmp = core::cmp; +#[cfg(not(test))] pub use owned = core::owned; #[cfg(not(test))] pub use ty = core::ty; pub use core::any; @@ -206,10 +207,6 @@ pub mod ascii; pub mod rc; pub mod gc; -/* Core language traits */ - -#[cfg(not(test))] pub mod owned; - /* Common traits */ pub mod from_str; diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 17249f567e5..8fbcd529b63 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -54,7 +54,7 @@ //! //! Rust's pointer types must always point to a valid location; there are //! no "null" pointers. Instead, Rust has *optional* pointers, like -//! the optional owned box, `Option<~T>`. +//! the optional owned box, `Option<Box<T>>`. //! //! The following example uses `Option` to create an optional box of //! `int`. Notice that in order to use the inner `int` value first the @@ -63,13 +63,13 @@ //! not (`None`). //! //! ``` -//! let optional: Option<~int> = None; +//! let optional: Option<Box<int>> = None; //! check_optional(&optional); //! -//! let optional: Option<~int> = Some(~9000); +//! let optional: Option<Box<int>> = Some(box 9000); //! check_optional(&optional); //! -//! fn check_optional(optional: &Option<~int>) { +//! fn check_optional(optional: &Option<Box<int>>) { //! match *optional { //! Some(ref p) => println!("have value {}", p), //! None => println!("have no value") @@ -79,7 +79,7 @@ //! //! This usage of `Option` to create safe nullable pointers is so //! common that Rust does special optimizations to make the -//! representation of `Option<~T>` a single pointer. Optional pointers +//! representation of `Option<Box<T>>` a single pointer. Optional pointers //! in Rust are stored as efficiently as any other pointer type. //! //! # Examples diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 47d316f75ab..809757aaf4d 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -81,6 +81,8 @@ pub fn getcwd() -> Path { pub fn getcwd() -> Path { use libc::DWORD; use libc::GetCurrentDirectoryW; + use option::Expect; + let mut buf = [0 as u16, ..BUF_BYTES]; unsafe { if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD { @@ -96,11 +98,11 @@ pub mod win32 { use iter::Iterator; use libc::types::os::arch::extra::DWORD; use libc; - use option::{None, Option}; + use option::{None, Option, Expect}; use option; use os::TMPBUF_SZ; use slice::{MutableVector, ImmutableVector, OwnedVector}; - use str::StrSlice; + use str::{StrSlice, StrAllocating}; use str; use vec::Vec; @@ -182,7 +184,6 @@ pub fn env_as_bytes() -> ~[(~[u8],~[u8])] { #[cfg(windows)] unsafe fn get_env_pairs() -> Vec<~[u8]> { use c_str; - use str::StrSlice; use libc::funcs::extra::kernel32::{ GetEnvironmentStringsA, @@ -830,6 +831,7 @@ fn real_args() -> ~[~str] { #[cfg(windows)] fn real_args() -> ~[~str] { use slice; + use option::Expect; let mut nArgs: c_int = 0; let lpArgCount: *mut c_int = &mut nArgs; diff --git a/src/libstd/owned.rs b/src/libstd/owned.rs deleted file mode 100644 index 4f282c5c9e9..00000000000 --- a/src/libstd/owned.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Operations on unique pointer types - -/// A value that represents the global exchange heap. This is the default -/// place that the `box` keyword allocates into when no place is supplied. -/// -/// The following two examples are equivalent: -/// -/// let foo = box(HEAP) Bar::new(...); -/// let foo = box Bar::new(...); -#[lang="exchange_heap"] -#[cfg(not(test))] -pub static HEAP: () = (); - -#[cfg(test)] -pub static HEAP: () = (); - -/// A type that represents a uniquely-owned value. -#[lang="owned_box"] -#[cfg(not(test))] -pub struct Box<T>(*T); - -#[cfg(test)] -pub struct Box<T>(*T); diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index 2fe4c7eafde..35c5cbc85c3 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -625,7 +625,6 @@ fn test_repr() { use io::stdio::println; use char::is_alphabetic; use mem::swap; - use owned::Box; fn exact_test<T>(t: &T, e:&str) { let mut m = io::MemWriter::new(); diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index 3f5ac535113..c7cefbb28ee 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -1577,7 +1577,6 @@ mod tests { #[test] #[should_fail] fn test_from_elem_fail() { - use cast; use cell::Cell; use rc::Rc; diff --git a/src/libstd/sync/mpmc_bounded_queue.rs b/src/libstd/sync/mpmc_bounded_queue.rs index b392cc8ff9a..2df5031b482 100644 --- a/src/libstd/sync/mpmc_bounded_queue.rs +++ b/src/libstd/sync/mpmc_bounded_queue.rs @@ -162,7 +162,6 @@ impl<T: Send> Clone for Queue<T> { #[cfg(test)] mod tests { use prelude::*; - use option::*; use super::Queue; use native; |
