Test fixes and rebase conflicts
This commit is contained in:
@@ -3274,7 +3274,7 @@ The machine types are the following:
|
|||||||
|
|
||||||
* The signed two's complement word types `i8`, `i16`, `i32` and `i64`, with
|
* The signed two's complement word types `i8`, `i16`, `i32` and `i64`, with
|
||||||
values drawn from the integer intervals [-(2^(7)), 2^7 - 1],
|
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.
|
respectively.
|
||||||
|
|
||||||
* The IEEE 754-2008 `binary32` and `binary64` floating-point types: `f32` and
|
* The IEEE 754-2008 `binary32` and `binary64` floating-point types: `f32` and
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ mod tests {
|
|||||||
use prelude::*;
|
use prelude::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
use owned::Box;
|
use owned::Box;
|
||||||
use str::StrSlice;
|
|
||||||
use realstd::str::StrAllocating;
|
use realstd::str::StrAllocating;
|
||||||
|
|
||||||
#[deriving(Eq, Show)]
|
#[deriving(Eq, Show)]
|
||||||
@@ -275,17 +274,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_show() {
|
fn test_show() {
|
||||||
<<<<<<< HEAD
|
let a = box 8u as Box<::realcore::any::Any>;
|
||||||
let a = box 8u as Box<Any>;
|
let b = box Test as Box<::realcore::any::Any>;
|
||||||
let b = box Test as Box<Any>;
|
|
||||||
assert_eq!(format!("{}", a), "Box<Any>".to_owned());
|
assert_eq!(format!("{}", a), "Box<Any>".to_owned());
|
||||||
assert_eq!(format!("{}", b), "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 a = &8u as &::realcore::any::Any;
|
||||||
let b = &Test as &::realcore::any::Any;
|
let b = &Test as &::realcore::any::Any;
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ extern_fn_clone!(A, B, C, D, E, F, G, H)
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
|
use owned::Box;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_owned_clone() {
|
fn test_owned_clone() {
|
||||||
@@ -154,8 +155,8 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_clone_from() {
|
fn test_clone_from() {
|
||||||
let a = ~5;
|
let a = box 5;
|
||||||
let mut b = ~10;
|
let mut b = box 10;
|
||||||
b.clone_from(&a);
|
b.clone_from(&a);
|
||||||
assert_eq!(*b, 5);
|
assert_eq!(*b, 5);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
|
|||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
mod impls {
|
mod impls {
|
||||||
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
|
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
|
||||||
|
use owned::Box;
|
||||||
|
|
||||||
// & pointers
|
// & pointers
|
||||||
impl<'a, T: Eq> Eq for &'a T {
|
impl<'a, T: Eq> Eq for &'a T {
|
||||||
@@ -240,28 +241,28 @@ mod impls {
|
|||||||
}
|
}
|
||||||
impl<T: TotalEq> TotalEq for @T {}
|
impl<T: TotalEq> TotalEq for @T {}
|
||||||
|
|
||||||
// ~ pointers
|
// box pointers
|
||||||
impl<T:Eq> Eq for ~T {
|
impl<T:Eq> Eq for Box<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
|
fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
|
||||||
#[inline]
|
#[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]
|
#[inline]
|
||||||
fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
|
fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
|
||||||
#[inline]
|
#[inline]
|
||||||
fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
|
fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
|
||||||
#[inline]
|
#[inline]
|
||||||
fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
|
fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
|
||||||
#[inline]
|
#[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]
|
#[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)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -27,9 +27,10 @@
|
|||||||
#[phase(syntax, link)] #[cfg(test)] extern crate realstd = "std";
|
#[phase(syntax, link)] #[cfg(test)] extern crate realstd = "std";
|
||||||
#[phase(syntax, link)] #[cfg(test)] extern crate log;
|
#[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 cmp = realcore::cmp;
|
||||||
|
#[cfg(test)] pub use kinds = realcore::kinds;
|
||||||
#[cfg(test)] pub use ops = realcore::ops;
|
#[cfg(test)] pub use ops = realcore::ops;
|
||||||
|
#[cfg(test)] pub use owned = realcore::owned;
|
||||||
#[cfg(test)] pub use ty = realcore::ty;
|
#[cfg(test)] pub use ty = realcore::ty;
|
||||||
|
|
||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
@@ -73,6 +74,7 @@ pub mod ptr;
|
|||||||
#[cfg(not(test))] pub mod ops;
|
#[cfg(not(test))] pub mod ops;
|
||||||
#[cfg(not(test))] pub mod ty;
|
#[cfg(not(test))] pub mod ty;
|
||||||
#[cfg(not(test))] pub mod cmp;
|
#[cfg(not(test))] pub mod cmp;
|
||||||
|
#[cfg(not(test))] pub mod owned;
|
||||||
pub mod clone;
|
pub mod clone;
|
||||||
pub mod default;
|
pub mod default;
|
||||||
pub mod container;
|
pub mod container;
|
||||||
|
|||||||
@@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
//! Operations on unique pointer types
|
//! 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
|
/// A value that represents the global exchange heap. This is the default
|
||||||
/// place that the `box` keyword allocates into when no place is supplied.
|
/// place that the `box` keyword allocates into when no place is supplied.
|
||||||
///
|
///
|
||||||
@@ -981,7 +981,6 @@ mod test {
|
|||||||
|
|
||||||
use native;
|
use native;
|
||||||
use os;
|
use os;
|
||||||
use owned::Box;
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub fn stress_factor() -> uint {
|
pub fn stress_factor() -> uint {
|
||||||
@@ -1516,7 +1515,6 @@ mod test {
|
|||||||
mod sync_tests {
|
mod sync_tests {
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use os;
|
use os;
|
||||||
use owned::Box;
|
|
||||||
|
|
||||||
pub fn stress_factor() -> uint {
|
pub fn stress_factor() -> uint {
|
||||||
match os::getenv("RUST_TEST_STRESS") {
|
match os::getenv("RUST_TEST_STRESS") {
|
||||||
|
|||||||
@@ -133,9 +133,10 @@ extern crate core;
|
|||||||
#[cfg(test)] pub use ty = realstd::ty;
|
#[cfg(test)] pub use ty = realstd::ty;
|
||||||
#[cfg(test)] pub use owned = realstd::owned;
|
#[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 kinds = core::kinds;
|
||||||
#[cfg(not(test))] pub use ops = core::ops;
|
#[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;
|
#[cfg(not(test))] pub use ty = core::ty;
|
||||||
|
|
||||||
pub use core::any;
|
pub use core::any;
|
||||||
@@ -206,10 +207,6 @@ pub mod ascii;
|
|||||||
pub mod rc;
|
pub mod rc;
|
||||||
pub mod gc;
|
pub mod gc;
|
||||||
|
|
||||||
/* Core language traits */
|
|
||||||
|
|
||||||
#[cfg(not(test))] pub mod owned;
|
|
||||||
|
|
||||||
/* Common traits */
|
/* Common traits */
|
||||||
|
|
||||||
pub mod from_str;
|
pub mod from_str;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Rust's pointer types must always point to a valid location; there are
|
//! Rust's pointer types must always point to a valid location; there are
|
||||||
//! no "null" pointers. Instead, Rust has *optional* pointers, like
|
//! 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
|
//! The following example uses `Option` to create an optional box of
|
||||||
//! `int`. Notice that in order to use the inner `int` value first the
|
//! `int`. Notice that in order to use the inner `int` value first the
|
||||||
@@ -63,13 +63,13 @@
|
|||||||
//! not (`None`).
|
//! not (`None`).
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! let optional: Option<~int> = None;
|
//! let optional: Option<Box<int>> = None;
|
||||||
//! check_optional(&optional);
|
//! check_optional(&optional);
|
||||||
//!
|
//!
|
||||||
//! let optional: Option<~int> = Some(~9000);
|
//! let optional: Option<Box<int>> = Some(box 9000);
|
||||||
//! check_optional(&optional);
|
//! check_optional(&optional);
|
||||||
//!
|
//!
|
||||||
//! fn check_optional(optional: &Option<~int>) {
|
//! fn check_optional(optional: &Option<Box<int>>) {
|
||||||
//! match *optional {
|
//! match *optional {
|
||||||
//! Some(ref p) => println!("have value {}", p),
|
//! Some(ref p) => println!("have value {}", p),
|
||||||
//! None => println!("have no value")
|
//! None => println!("have no value")
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
//!
|
//!
|
||||||
//! This usage of `Option` to create safe nullable pointers is so
|
//! This usage of `Option` to create safe nullable pointers is so
|
||||||
//! common that Rust does special optimizations to make the
|
//! 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.
|
//! in Rust are stored as efficiently as any other pointer type.
|
||||||
//!
|
//!
|
||||||
//! # Examples
|
//! # Examples
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ pub fn getcwd() -> Path {
|
|||||||
pub fn getcwd() -> Path {
|
pub fn getcwd() -> Path {
|
||||||
use libc::DWORD;
|
use libc::DWORD;
|
||||||
use libc::GetCurrentDirectoryW;
|
use libc::GetCurrentDirectoryW;
|
||||||
|
use option::Expect;
|
||||||
|
|
||||||
let mut buf = [0 as u16, ..BUF_BYTES];
|
let mut buf = [0 as u16, ..BUF_BYTES];
|
||||||
unsafe {
|
unsafe {
|
||||||
if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD {
|
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 iter::Iterator;
|
||||||
use libc::types::os::arch::extra::DWORD;
|
use libc::types::os::arch::extra::DWORD;
|
||||||
use libc;
|
use libc;
|
||||||
use option::{None, Option};
|
use option::{None, Option, Expect};
|
||||||
use option;
|
use option;
|
||||||
use os::TMPBUF_SZ;
|
use os::TMPBUF_SZ;
|
||||||
use slice::{MutableVector, ImmutableVector, OwnedVector};
|
use slice::{MutableVector, ImmutableVector, OwnedVector};
|
||||||
use str::StrSlice;
|
use str::{StrSlice, StrAllocating};
|
||||||
use str;
|
use str;
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
@@ -182,7 +184,6 @@ pub fn env_as_bytes() -> ~[(~[u8],~[u8])] {
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe fn get_env_pairs() -> Vec<~[u8]> {
|
unsafe fn get_env_pairs() -> Vec<~[u8]> {
|
||||||
use c_str;
|
use c_str;
|
||||||
use str::StrSlice;
|
|
||||||
|
|
||||||
use libc::funcs::extra::kernel32::{
|
use libc::funcs::extra::kernel32::{
|
||||||
GetEnvironmentStringsA,
|
GetEnvironmentStringsA,
|
||||||
@@ -830,6 +831,7 @@ fn real_args() -> ~[~str] {
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn real_args() -> ~[~str] {
|
fn real_args() -> ~[~str] {
|
||||||
use slice;
|
use slice;
|
||||||
|
use option::Expect;
|
||||||
|
|
||||||
let mut nArgs: c_int = 0;
|
let mut nArgs: c_int = 0;
|
||||||
let lpArgCount: *mut c_int = &mut nArgs;
|
let lpArgCount: *mut c_int = &mut nArgs;
|
||||||
|
|||||||
@@ -625,7 +625,6 @@ fn test_repr() {
|
|||||||
use io::stdio::println;
|
use io::stdio::println;
|
||||||
use char::is_alphabetic;
|
use char::is_alphabetic;
|
||||||
use mem::swap;
|
use mem::swap;
|
||||||
use owned::Box;
|
|
||||||
|
|
||||||
fn exact_test<T>(t: &T, e:&str) {
|
fn exact_test<T>(t: &T, e:&str) {
|
||||||
let mut m = io::MemWriter::new();
|
let mut m = io::MemWriter::new();
|
||||||
|
|||||||
@@ -1577,7 +1577,6 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[should_fail]
|
#[should_fail]
|
||||||
fn test_from_elem_fail() {
|
fn test_from_elem_fail() {
|
||||||
use cast;
|
|
||||||
use cell::Cell;
|
use cell::Cell;
|
||||||
use rc::Rc;
|
use rc::Rc;
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ impl<T: Send> Clone for Queue<T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use option::*;
|
|
||||||
use super::Queue;
|
use super::Queue;
|
||||||
use native;
|
use native;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user