Skip to content
1 change: 1 addition & 0 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
save_metrics: config.save_metrics.clone(),
test_shard: config.test_shard.clone(),
nocapture: false,
color: test::AutoColor,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use std::os;
use std::str;
use std::io::process::{ProcessExit, Command, Process, ProcessOutput};
use std::unstable::dynamic_lib::DynamicLibrary;
use std::dynamic_lib::DynamicLibrary;

fn target_env(lib_path: &str, prog: &str) -> Vec<(String, String)> {
let prog = if cfg!(windows) {prog.slice_to(prog.len() - 4)} else {prog};
Expand Down
6 changes: 6 additions & 0 deletions src/libcollections/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use core::prelude::*;

use core::cmp;
use core::default::Default;
use core::fmt;
use core::iter::{Enumerate, Repeat, Map, Zip};
use core::ops;
Expand Down Expand Up @@ -698,6 +699,11 @@ pub struct BitvSet {
bitv: BigBitv
}

impl Default for BitvSet {
#[inline]
fn default() -> BitvSet { BitvSet::new() }
}

impl BitvSet {
/// Creates a new bit vector set with initially no contents
pub fn new() -> BitvSet {
Expand Down
6 changes: 6 additions & 0 deletions src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use core::prelude::*;

use alloc::owned::Box;
use core::default::Default;
use core::fmt;
use core::iter;
use core::mem;
Expand Down Expand Up @@ -262,6 +263,11 @@ impl<T> Deque<T> for DList<T> {
}
}

impl<T> Default for DList<T> {
#[inline]
fn default() -> DList<T> { DList::new() }
}

impl<T> DList<T> {
/// Create an empty DList
#[inline]
Expand Down
6 changes: 6 additions & 0 deletions src/libcollections/priority_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use core::prelude::*;

use core::default::Default;
use core::mem::{zeroed, replace, swap};
use core::ptr;

Expand All @@ -37,6 +38,11 @@ impl<T: Ord> Mutable for PriorityQueue<T> {
fn clear(&mut self) { self.data.truncate(0) }
}

impl<T: Ord> Default for PriorityQueue<T> {
#[inline]
fn default() -> PriorityQueue<T> { PriorityQueue::new() }
}

impl<T: Ord> PriorityQueue<T> {
/// An iterator visiting all values in underlying vector, in
/// arbitrary order.
Expand Down
6 changes: 6 additions & 0 deletions src/libcollections/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use core::prelude::*;

use core::cmp;
use core::default::Default;
use core::fmt;
use core::iter::RandomAccessIterator;

Expand Down Expand Up @@ -112,6 +113,11 @@ impl<T> Deque<T> for RingBuf<T> {
}
}

impl<T> Default for RingBuf<T> {
#[inline]
fn default() -> RingBuf<T> { RingBuf::new() }
}

impl<T> RingBuf<T> {
/// Create an empty RingBuf
pub fn new() -> RingBuf<T> {
Expand Down
6 changes: 6 additions & 0 deletions src/libcollections/smallintmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use core::prelude::*;

use core::default::Default;
use core::fmt;
use core::iter::{Enumerate, FilterMap};
use core::mem::replace;
Expand Down Expand Up @@ -114,6 +115,11 @@ impl<V> MutableMap<uint, V> for SmallIntMap<V> {
}
}

impl<V> Default for SmallIntMap<V> {
#[inline]
fn default() -> SmallIntMap<V> { SmallIntMap::new() }
}

impl<V> SmallIntMap<V> {
/// Create an empty SmallIntMap
pub fn new() -> SmallIntMap<V> { SmallIntMap{v: vec!()} }
Expand Down
11 changes: 11 additions & 0 deletions src/libcollections/treemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use core::prelude::*;

use alloc::owned::Box;
use core::default::Default;
use core::fmt;
use core::fmt::Show;
use core::iter::Peekable;
Expand Down Expand Up @@ -135,6 +136,11 @@ impl<K: Ord, V> MutableMap<K, V> for TreeMap<K, V> {
}
}

impl<K: Ord, V> Default for TreeMap<K,V> {
#[inline]
fn default() -> TreeMap<K, V> { TreeMap::new() }
}

impl<K: Ord, V> TreeMap<K, V> {
/// Create an empty TreeMap
pub fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
Expand Down Expand Up @@ -633,6 +639,11 @@ impl<T: Ord> MutableSet<T> for TreeSet<T> {
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
}

impl<T: Ord> Default for TreeSet<T> {
#[inline]
fn default() -> TreeSet<T> { TreeSet::new() }
}

impl<T: Ord> TreeSet<T> {
/// Create an empty TreeSet
#[inline]
Expand Down
11 changes: 11 additions & 0 deletions src/libcollections/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use core::prelude::*;

use alloc::owned::Box;
use core::default::Default;
use core::mem::zeroed;
use core::mem;
use core::uint;
Expand Down Expand Up @@ -105,6 +106,11 @@ impl<T> MutableMap<uint, T> for TrieMap<T> {
}
}

impl<T> Default for TrieMap<T> {
#[inline]
fn default() -> TrieMap<T> { TrieMap::new() }
}

impl<T> TrieMap<T> {
/// Create an empty TrieMap
#[inline]
Expand Down Expand Up @@ -332,6 +338,11 @@ impl MutableSet<uint> for TrieSet {
}
}

impl Default for TrieSet {
#[inline]
fn default() -> TrieSet { TrieSet::new() }
}

impl TrieSet {
/// Create an empty TrieSet
#[inline]
Expand Down
12 changes: 5 additions & 7 deletions src/libnative/io/c_win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ extern "system" {
pub mod compat {
use std::intrinsics::{atomic_store_relaxed, transmute};
use libc::types::os::arch::extra::{LPCWSTR, HMODULE, LPCSTR, LPVOID};
use std::os::win32::as_utf16_p;

extern "system" {
fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE;
Expand All @@ -80,12 +79,11 @@ pub mod compat {
// This way, calling a function in this compatibility layer (after it's loaded) shouldn't
// be any slower than a regular DLL call.
unsafe fn store_func<T: Copy>(ptr: *mut T, module: &str, symbol: &str, fallback: T) {
as_utf16_p(module, |module| {
symbol.with_c_str(|symbol| {
let handle = GetModuleHandleW(module);
let func: Option<T> = transmute(GetProcAddress(handle, symbol));
atomic_store_relaxed(ptr, func.unwrap_or(fallback))
})
let module = module.to_utf16().append_one(0);
symbol.with_c_str(|symbol| {
let handle = GetModuleHandleW(module.as_ptr());
let func: Option<T> = transmute(GetProcAddress(handle, symbol));
atomic_store_relaxed(ptr, func.unwrap_or(fallback))
})
}

Expand Down
Loading