Skip to content

Commit 07caa22

Browse files
committed
Test fixes and rebase conflicts
1 parent a289ebe commit 07caa22

File tree

13 files changed

+39
-44
lines changed

13 files changed

+39
-44
lines changed

src/doc/rust.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,7 @@ The machine types are the following:
32743274

32753275
* The signed two's complement word types `i8`, `i16`, `i32` and `i64`, with
32763276
values drawn from the integer intervals [-(2^(7)), 2^7 - 1],
3277-
[-(2^(15)), 2^15 - 1], $[-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
3277+
[-(2^(15)), 2^15 - 1], [-(2^(31)), 2^31 - 1], [-(2^(63)), 2^63 - 1]
32783278
respectively.
32793279

32803280
* The IEEE 754-2008 `binary32` and `binary64` floating-point types: `f32` and

src/libcore/any.rs

+2-10
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ mod tests {
149149
use prelude::*;
150150
use super::*;
151151
use owned::Box;
152-
use str::StrSlice;
153152
use realstd::str::StrAllocating;
154153

155154
#[deriving(Eq, Show)]
@@ -275,17 +274,10 @@ mod tests {
275274

276275
#[test]
277276
fn test_show() {
278-
<<<<<<< HEAD
279-
let a = box 8u as Box<Any>;
280-
let b = box Test as Box<Any>;
277+
let a = box 8u as Box<::realcore::any::Any>;
278+
let b = box Test as Box<::realcore::any::Any>;
281279
assert_eq!(format!("{}", a), "Box<Any>".to_owned());
282280
assert_eq!(format!("{}", b), "Box<Any>".to_owned());
283-
=======
284-
let a = ~8u as ~::realcore::any::Any;
285-
let b = ~Test as ~::realcore::any::Any;
286-
assert_eq!(format!("{}", a), "~Any".to_owned());
287-
assert_eq!(format!("{}", b), "~Any".to_owned());
288-
>>>>>>> core: Get coretest working
289281

290282
let a = &8u as &::realcore::any::Any;
291283
let b = &Test as &::realcore::any::Any;

src/libcore/clone.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ extern_fn_clone!(A, B, C, D, E, F, G, H)
129129
#[cfg(test)]
130130
mod test {
131131
use prelude::*;
132+
use owned::Box;
132133

133134
#[test]
134135
fn test_owned_clone() {
@@ -154,8 +155,8 @@ mod test {
154155

155156
#[test]
156157
fn test_clone_from() {
157-
let a = ~5;
158-
let mut b = ~10;
158+
let a = box 5;
159+
let mut b = box 10;
159160
b.clone_from(&a);
160161
assert_eq!(*b, 5);
161162
}

src/libcore/cmp.rs

+13-12
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
193193
#[cfg(not(test))]
194194
mod impls {
195195
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
196+
use owned::Box;
196197

197198
// & pointers
198199
impl<'a, T: Eq> Eq for &'a T {
@@ -240,28 +241,28 @@ mod impls {
240241
}
241242
impl<T: TotalEq> TotalEq for @T {}
242243

243-
// ~ pointers
244-
impl<T:Eq> Eq for ~T {
244+
// box pointers
245+
impl<T:Eq> Eq for Box<T> {
245246
#[inline]
246-
fn eq(&self, other: &~T) -> bool { *(*self) == *(*other) }
247+
fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
247248
#[inline]
248-
fn ne(&self, other: &~T) -> bool { *(*self) != *(*other) }
249+
fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
249250
}
250-
impl<T:Ord> Ord for ~T {
251+
impl<T:Ord> Ord for Box<T> {
251252
#[inline]
252-
fn lt(&self, other: &~T) -> bool { *(*self) < *(*other) }
253+
fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
253254
#[inline]
254-
fn le(&self, other: &~T) -> bool { *(*self) <= *(*other) }
255+
fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
255256
#[inline]
256-
fn ge(&self, other: &~T) -> bool { *(*self) >= *(*other) }
257+
fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
257258
#[inline]
258-
fn gt(&self, other: &~T) -> bool { *(*self) > *(*other) }
259+
fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
259260
}
260-
impl<T: TotalOrd> TotalOrd for ~T {
261+
impl<T: TotalOrd> TotalOrd for Box<T> {
261262
#[inline]
262-
fn cmp(&self, other: &~T) -> Ordering { (**self).cmp(*other) }
263+
fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
263264
}
264-
impl<T: TotalEq> TotalEq for ~T {}
265+
impl<T: TotalEq> TotalEq for Box<T> {}
265266
}
266267

267268
#[cfg(test)]

src/libcore/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
#[phase(syntax, link)] #[cfg(test)] extern crate realstd = "std";
2828
#[phase(syntax, link)] #[cfg(test)] extern crate log;
2929

30-
#[cfg(test)] pub use kinds = realcore::kinds;
3130
#[cfg(test)] pub use cmp = realcore::cmp;
31+
#[cfg(test)] pub use kinds = realcore::kinds;
3232
#[cfg(test)] pub use ops = realcore::ops;
33+
#[cfg(test)] pub use owned = realcore::owned;
3334
#[cfg(test)] pub use ty = realcore::ty;
3435

3536
#[cfg(not(test))]
@@ -73,6 +74,7 @@ pub mod ptr;
7374
#[cfg(not(test))] pub mod ops;
7475
#[cfg(not(test))] pub mod ty;
7576
#[cfg(not(test))] pub mod cmp;
77+
#[cfg(not(test))] pub mod owned;
7678
pub mod clone;
7779
pub mod default;
7880
pub mod container;

src/libstd/owned.rs renamed to src/libcore/owned.rs

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

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

src/libstd/comm/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,6 @@ mod test {
981981

982982
use native;
983983
use os;
984-
use owned::Box;
985984
use super::*;
986985

987986
pub fn stress_factor() -> uint {
@@ -1516,7 +1515,6 @@ mod test {
15161515
mod sync_tests {
15171516
use prelude::*;
15181517
use os;
1519-
use owned::Box;
15201518

15211519
pub fn stress_factor() -> uint {
15221520
match os::getenv("RUST_TEST_STRESS") {

src/libstd/lib.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ extern crate core;
133133
#[cfg(test)] pub use ty = realstd::ty;
134134
#[cfg(test)] pub use owned = realstd::owned;
135135

136+
#[cfg(not(test))] pub use cmp = core::cmp;
136137
#[cfg(not(test))] pub use kinds = core::kinds;
137138
#[cfg(not(test))] pub use ops = core::ops;
138-
#[cfg(not(test))] pub use cmp = core::cmp;
139+
#[cfg(not(test))] pub use owned = core::owned;
139140
#[cfg(not(test))] pub use ty = core::ty;
140141

141142
pub use core::any;
@@ -206,10 +207,6 @@ pub mod ascii;
206207
pub mod rc;
207208
pub mod gc;
208209

209-
/* Core language traits */
210-
211-
#[cfg(not(test))] pub mod owned;
212-
213210
/* Common traits */
214211

215212
pub mod from_str;

src/libstd/option.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
//!
5555
//! Rust's pointer types must always point to a valid location; there are
5656
//! no "null" pointers. Instead, Rust has *optional* pointers, like
57-
//! the optional owned box, `Option<~T>`.
57+
//! the optional owned box, `Option<Box<T>>`.
5858
//!
5959
//! The following example uses `Option` to create an optional box of
6060
//! `int`. Notice that in order to use the inner `int` value first the
@@ -63,13 +63,13 @@
6363
//! not (`None`).
6464
//!
6565
//! ```
66-
//! let optional: Option<~int> = None;
66+
//! let optional: Option<Box<int>> = None;
6767
//! check_optional(&optional);
6868
//!
69-
//! let optional: Option<~int> = Some(~9000);
69+
//! let optional: Option<Box<int>> = Some(box 9000);
7070
//! check_optional(&optional);
7171
//!
72-
//! fn check_optional(optional: &Option<~int>) {
72+
//! fn check_optional(optional: &Option<Box<int>>) {
7373
//! match *optional {
7474
//! Some(ref p) => println!("have value {}", p),
7575
//! None => println!("have no value")
@@ -79,7 +79,7 @@
7979
//!
8080
//! This usage of `Option` to create safe nullable pointers is so
8181
//! common that Rust does special optimizations to make the
82-
//! representation of `Option<~T>` a single pointer. Optional pointers
82+
//! representation of `Option<Box<T>>` a single pointer. Optional pointers
8383
//! in Rust are stored as efficiently as any other pointer type.
8484
//!
8585
//! # Examples

src/libstd/os.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ pub fn getcwd() -> Path {
8181
pub fn getcwd() -> Path {
8282
use libc::DWORD;
8383
use libc::GetCurrentDirectoryW;
84+
use option::Expect;
85+
8486
let mut buf = [0 as u16, ..BUF_BYTES];
8587
unsafe {
8688
if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD {
@@ -96,11 +98,11 @@ pub mod win32 {
9698
use iter::Iterator;
9799
use libc::types::os::arch::extra::DWORD;
98100
use libc;
99-
use option::{None, Option};
101+
use option::{None, Option, Expect};
100102
use option;
101103
use os::TMPBUF_SZ;
102104
use slice::{MutableVector, ImmutableVector, OwnedVector};
103-
use str::StrSlice;
105+
use str::{StrSlice, StrAllocating};
104106
use str;
105107
use vec::Vec;
106108

@@ -182,7 +184,6 @@ pub fn env_as_bytes() -> ~[(~[u8],~[u8])] {
182184
#[cfg(windows)]
183185
unsafe fn get_env_pairs() -> Vec<~[u8]> {
184186
use c_str;
185-
use str::StrSlice;
186187

187188
use libc::funcs::extra::kernel32::{
188189
GetEnvironmentStringsA,
@@ -830,6 +831,7 @@ fn real_args() -> ~[~str] {
830831
#[cfg(windows)]
831832
fn real_args() -> ~[~str] {
832833
use slice;
834+
use option::Expect;
833835

834836
let mut nArgs: c_int = 0;
835837
let lpArgCount: *mut c_int = &mut nArgs;

src/libstd/repr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ fn test_repr() {
625625
use io::stdio::println;
626626
use char::is_alphabetic;
627627
use mem::swap;
628-
use owned::Box;
629628

630629
fn exact_test<T>(t: &T, e:&str) {
631630
let mut m = io::MemWriter::new();

src/libstd/slice.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,6 @@ mod tests {
15771577
#[test]
15781578
#[should_fail]
15791579
fn test_from_elem_fail() {
1580-
use cast;
15811580
use cell::Cell;
15821581
use rc::Rc;
15831582

src/libstd/sync/mpmc_bounded_queue.rs

-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ impl<T: Send> Clone for Queue<T> {
162162
#[cfg(test)]
163163
mod tests {
164164
use prelude::*;
165-
use option::*;
166165
use super::Queue;
167166
use native;
168167

0 commit comments

Comments
 (0)