Test fixes and rebase conflicts

This commit is contained in:
Alex Crichton 2014-05-07 08:20:22 -07:00
parent a289ebefb8
commit 07caa22450
13 changed files with 39 additions and 44 deletions

View File

@ -3274,7 +3274,7 @@ The machine types are the following:
* The signed two's complement word types `i8`, `i16`, `i32` and `i64`, with
values drawn from the integer intervals [-(2^(7)), 2^7 - 1],
[-(2^(15)), 2^15 - 1], $[-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
[-(2^(15)), 2^15 - 1], [-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
respectively.
* The IEEE 754-2008 `binary32` and `binary64` floating-point types: `f32` and

View File

@ -149,7 +149,6 @@ mod tests {
use prelude::*;
use super::*;
use owned::Box;
use str::StrSlice;
use realstd::str::StrAllocating;
#[deriving(Eq, Show)]
@ -275,17 +274,10 @@ mod tests {
#[test]
fn test_show() {
<<<<<<< HEAD
let a = box 8u as Box<Any>;
let b = box Test as Box<Any>;
let a = box 8u as Box<::realcore::any::Any>;
let b = box Test as Box<::realcore::any::Any>;
assert_eq!(format!("{}", a), "Box<Any>".to_owned());
assert_eq!(format!("{}", b), "Box<Any>".to_owned());
=======
let a = ~8u as ~::realcore::any::Any;
let b = ~Test as ~::realcore::any::Any;
assert_eq!(format!("{}", a), "~Any".to_owned());
assert_eq!(format!("{}", b), "~Any".to_owned());
>>>>>>> core: Get coretest working
let a = &8u as &::realcore::any::Any;
let b = &Test as &::realcore::any::Any;

View File

@ -129,6 +129,7 @@ extern_fn_clone!(A, B, C, D, E, F, G, H)
#[cfg(test)]
mod test {
use prelude::*;
use owned::Box;
#[test]
fn test_owned_clone() {
@ -154,8 +155,8 @@ mod test {
#[test]
fn test_clone_from() {
let a = ~5;
let mut b = ~10;
let a = box 5;
let mut b = box 10;
b.clone_from(&a);
assert_eq!(*b, 5);
}

View File

@ -193,6 +193,7 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
#[cfg(not(test))]
mod impls {
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
use owned::Box;
// & pointers
impl<'a, T: Eq> Eq for &'a T {
@ -240,28 +241,28 @@ mod impls {
}
impl<T: TotalEq> TotalEq for @T {}
// ~ pointers
impl<T:Eq> Eq for ~T {
// box pointers
impl<T:Eq> Eq for Box<T> {
#[inline]
fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
#[inline]
fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
}
impl<T:Ord> Ord for ~T {
impl<T:Ord> Ord for Box<T> {
#[inline]
fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
#[inline]
fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
#[inline]
fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
#[inline]
fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
}
impl<T: TotalOrd> TotalOrd for ~T {
impl<T: TotalOrd> TotalOrd for Box<T> {
#[inline]
fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
}
impl<T: TotalEq> TotalEq for ~T {}
impl<T: TotalEq> TotalEq for Box<T> {}
}
#[cfg(test)]

View File

@ -27,9 +27,10 @@
#[phase(syntax, link)] #[cfg(test)] extern crate realstd = "std";
#[phase(syntax, link)] #[cfg(test)] extern crate log;
#[cfg(test)] pub use kinds = realcore::kinds;
#[cfg(test)] pub use cmp = realcore::cmp;
#[cfg(test)] pub use kinds = realcore::kinds;
#[cfg(test)] pub use ops = realcore::ops;
#[cfg(test)] pub use owned = realcore::owned;
#[cfg(test)] pub use ty = realcore::ty;
#[cfg(not(test))]
@ -73,6 +74,7 @@ pub mod ptr;
#[cfg(not(test))] pub mod ops;
#[cfg(not(test))] pub mod ty;
#[cfg(not(test))] pub mod cmp;
#[cfg(not(test))] pub mod owned;
pub mod clone;
pub mod default;
pub mod container;

View File

@ -10,6 +10,11 @@
//! Operations on unique pointer types
// FIXME: this module should not exist in libcore. It must currently because the
// Box implementation is quite ad-hoc in the compiler. Once there is
// proper support in the compiler this type will be able to be defined in
// its own module.
/// A value that represents the global exchange heap. This is the default
/// place that the `box` keyword allocates into when no place is supplied.
///

View File

@ -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") {

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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();

View File

@ -1577,7 +1577,6 @@ mod tests {
#[test]
#[should_fail]
fn test_from_elem_fail() {
use cast;
use cell::Cell;
use rc::Rc;

View File

@ -162,7 +162,6 @@ impl<T: Send> Clone for Queue<T> {
#[cfg(test)]
mod tests {
use prelude::*;
use option::*;
use super::Queue;
use native;