From 582cba183f18eea5c40b6c035d63ad449a9e8604 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 30 Dec 2014 16:29:27 -0800 Subject: [PATCH] Test fixes and rebase conflicts --- src/liballoc/arc.rs | 1 + src/libcollections/btree/node.rs | 8 ++++---- src/libcollections/slice.rs | 4 ++-- src/libcoretest/atomic.rs | 1 + src/librustc_back/sha2.rs | 5 +++-- src/libstd/collections/hash/map.rs | 6 +++--- src/libstd/collections/hash/table.rs | 6 +++--- src/libstd/os.rs | 1 + src/libstd/sys/windows/os.rs | 2 +- src/test/compile-fail/trait-object-safety.rs | 1 - src/test/run-pass/issue-12684.rs | 3 ++- 11 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 03634657a71b7..820a3838978c0 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -600,6 +600,7 @@ mod tests { use std::option::Option::{Some, None}; use std::str::Str; use std::sync::atomic; + use std::sync::atomic::Ordering::{Acquire, SeqCst}; use std::task; use std::kinds::Send; use std::vec::Vec; diff --git a/src/libcollections/btree/node.rs b/src/libcollections/btree/node.rs index 8f51b55170076..3907f28092a37 100644 --- a/src/libcollections/btree/node.rs +++ b/src/libcollections/btree/node.rs @@ -304,9 +304,9 @@ impl Node { let (vals_offset, _) = calculate_offsets_generic::(capacity, true); Node { - keys: Unique(buffer as *mut K). + keys: Unique(buffer as *mut K), vals: Unique(unsafe { buffer.offset(vals_offset as int) as *mut V }), - edges: Unique(ptr::null_mut::()), + edges: Unique(ptr::null_mut()), _len: 0, _capacity: capacity, } @@ -574,7 +574,7 @@ impl Node { /// If the node has any children pub fn is_leaf(&self) -> bool { - self.edges.is_null() + self.edges.0.is_null() } /// if the node has too few elements @@ -1058,7 +1058,7 @@ impl Node { vals: RawItems::from_slice(self.vals()), edges: RawItems::from_slice(self.edges()), - ptr: self.keys as *mut u8, + ptr: self.keys.0 as *mut u8, capacity: self.capacity(), is_leaf: self.is_leaf() }, diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index bbe6ecc8ea6b5..02b70c0f169d8 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1102,11 +1102,11 @@ impl ToOwned> for [T] { // Iterators //////////////////////////////////////////////////////////////////////////////// -#[deriving(Copy)] +#[deriving(Copy, Clone)] enum Direction { Pos, Neg } /// An `Index` and `Direction` together. -#[deriving(Copy)] +#[deriving(Copy, Clone)] struct SizeDirection { size: uint, dir: Direction, diff --git a/src/libcoretest/atomic.rs b/src/libcoretest/atomic.rs index ab9c7ab9f11da..1fee304a97648 100644 --- a/src/libcoretest/atomic.rs +++ b/src/libcoretest/atomic.rs @@ -9,6 +9,7 @@ // except according to those terms. use core::atomic::*; +use core::atomic::Ordering::SeqCst; #[test] fn bool_() { diff --git a/src/librustc_back/sha2.rs b/src/librustc_back/sha2.rs index a7d1d3a23bd13..366e33d6384ba 100644 --- a/src/librustc_back/sha2.rs +++ b/src/librustc_back/sha2.rs @@ -530,11 +530,12 @@ static H256: [u32, ..8] = [ mod tests { extern crate rand; - use super::{Digest, Sha256, FixedBuffer}; - use self::rand::isaac::IsaacRng; use self::rand::Rng; + use self::rand::isaac::IsaacRng; use serialize::hex::FromHex; + use std::iter::repeat; use std::num::Int; + use super::{Digest, Sha256, FixedBuffer}; // A normal addition - no overflow occurs #[test] diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 8181ea5253f93..3bfe2009f8b4b 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1320,9 +1320,9 @@ pub struct Iter<'a, K: 'a, V: 'a> { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` -impl<'a, K, V> Clone for Entries<'a, K, V> { - fn clone(&self) -> Entries<'a, K, V> { - Entries { +impl<'a, K, V> Clone for Iter<'a, K, V> { + fn clone(&self) -> Iter<'a, K, V> { + Iter { inner: self.inner.clone() } } diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index f5fbfcabcfb71..6938ab9b0b6d7 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -788,9 +788,9 @@ pub struct Iter<'a, K: 'a, V: 'a> { } // FIXME(#19839) Remove in favor of `#[deriving(Clone)]` -impl<'a, K, V> Clone for Entries<'a, K, V> { - fn clone(&self) -> Entries<'a, K, V> { - Entries { +impl<'a, K, V> Clone for Iter<'a, K, V> { + fn clone(&self) -> Iter<'a, K, V> { + Iter { iter: self.iter.clone(), elems_left: self.elems_left } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index a9d9607395ce5..df50b7f81afcf 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -716,6 +716,7 @@ fn real_args() -> Vec { #[cfg(windows)] fn real_args() -> Vec { use slice; + use iter::range; let mut nArgs: c_int = 0; let lpArgCount: *mut c_int = &mut nArgs; diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 235ebf211ac08..28eca9163f6e5 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -129,7 +129,7 @@ pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) -> Option = repeat(0u16).take(n).collect(); + let mut buf: Vec = repeat(0u16).take(n as uint).collect(); let k = f(buf.as_mut_ptr(), n); if k == (0 as DWORD) { done = true; diff --git a/src/test/compile-fail/trait-object-safety.rs b/src/test/compile-fail/trait-object-safety.rs index d594e3e17474b..761bcd4968abf 100644 --- a/src/test/compile-fail/trait-object-safety.rs +++ b/src/test/compile-fail/trait-object-safety.rs @@ -22,5 +22,4 @@ impl Tr for St { fn main() { let _: &Tr = &St; //~ ERROR cannot convert to a trait object because trait `Tr` is not - //~^ NOTE cannot call a static method (`foo`) through a trait object } diff --git a/src/test/run-pass/issue-12684.rs b/src/test/run-pass/issue-12684.rs index e24cf5a0f2670..856fbbd00b20b 100644 --- a/src/test/run-pass/issue-12684.rs +++ b/src/test/run-pass/issue-12684.rs @@ -9,9 +9,10 @@ // except according to those terms. use std::time::Duration; +use std::thread::Thread; fn main() { - std::task::spawn(move|| customtask()); + Thread::spawn(move|| customtask()).join().ok().unwrap(); } fn customtask() {