1
Fork 0

Move std::{trie, hashmap} to libcollections

These two containers are indeed collections, so their place is in
libcollections, not in libstd. There will always be a hash map as part of the
standard distribution of Rust, but by moving it out of the standard library it
makes libstd that much more portable to more platforms and environments.

This conveniently also removes the stuttering of 'std::hashmap::HashMap',
although 'collections::HashMap' is only one character shorter.
This commit is contained in:
Alex Crichton 2014-02-19 19:29:58 -08:00
parent edf351e9f7
commit 2a14e084cf
109 changed files with 448 additions and 436 deletions

View file

@ -69,7 +69,7 @@ DEPS_flate := std native:miniz
DEPS_arena := std collections DEPS_arena := std collections
DEPS_glob := std DEPS_glob := std
DEPS_serialize := std DEPS_serialize := std
DEPS_term := std DEPS_term := std collections
DEPS_semver := std DEPS_semver := std
DEPS_uuid := std serialize DEPS_uuid := std serialize
DEPS_sync := std DEPS_sync := std

View file

@ -467,7 +467,7 @@ expression context, the final namespace qualifier is omitted.
Two examples of paths with type arguments: Two examples of paths with type arguments:
~~~~ ~~~~
# use std::hashmap::HashMap; # struct HashMap<K, V>;
# fn f() { # fn f() {
# fn id<T>(t: T) -> T { t } # fn id<T>(t: T) -> T { t }
type T = HashMap<int,~str>; // Type arguments used in a type expression type T = HashMap<int,~str>; // Type arguments used in a type expression

View file

@ -1977,8 +1977,8 @@ illegal to copy and pass by value.
Generic `type`, `struct`, and `enum` declarations follow the same pattern: Generic `type`, `struct`, and `enum` declarations follow the same pattern:
~~~~ ~~~~
use std::hashmap::HashMap; extern crate collections;
type Set<T> = HashMap<T, ()>; type Set<T> = collections::HashMap<T, ()>;
struct Stack<T> { struct Stack<T> {
elements: ~[T] elements: ~[T]
@ -1988,6 +1988,7 @@ enum Option<T> {
Some(T), Some(T),
None None
} }
# fn main() {}
~~~~ ~~~~
These declarations can be instantiated to valid types like `Set<int>`, These declarations can be instantiated to valid types like `Set<int>`,

View file

@ -55,6 +55,8 @@ c.write(
#[crate_id=\"run_pass_stage2#0.1\"]; #[crate_id=\"run_pass_stage2#0.1\"];
#[feature(globs, macro_rules, struct_variant, managed_boxes)]; #[feature(globs, macro_rules, struct_variant, managed_boxes)];
#[allow(warnings)]; #[allow(warnings)];
extern crate collections;
extern crate extra;
""" """
) )
for t in stage2_tests: for t in stage2_tests:

View file

@ -16,7 +16,7 @@
//! # Example //! # Example
//! //!
//! ```rust //! ```rust
//! use std::hashmap::HashMap; //! use collections::HashMap;
//! //!
//! // type inference lets us omit an explicit type signature (which //! // type inference lets us omit an explicit type signature (which
//! // would be `HashMap<&str, &str>` in this example). //! // would be `HashMap<&str, &str>` in this example).
@ -52,24 +52,20 @@
//! } //! }
//! ``` //! ```
use container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; use std::cmp::max;
use clone::Clone; use std::fmt;
use cmp::{Eq, Equiv, max}; use std::hash_old::Hash;
use default::Default; use std::iter::{FilterMap, Chain, Repeat, Zip};
use fmt; use std::iter;
use hash_old::Hash; use std::mem::replace;
use iter; use std::num;
use iter::{Iterator, FromIterator, Extendable}; use std::rand::Rng;
use iter::{FilterMap, Chain, Repeat, Zip}; use std::rand;
use mem::replace; use std::vec::{Items, MutItems};
use num; use std::vec_ng::Vec;
use option::{None, Option, Some}; use std::vec_ng;
use rand::Rng;
use rand; use serialize::{Encodable, Decodable, Encoder, Decoder};
use result::{Ok, Err};
use vec::{ImmutableVector, MutableVector, OwnedVector, Items, MutItems};
use vec_ng;
use vec_ng::Vec;
static INITIAL_CAPACITY: uint = 32u; // 2^5 static INITIAL_CAPACITY: uint = 32u; // 2^5
@ -404,7 +400,7 @@ impl<K: Hash + Eq, V> HashMap<K, V> {
/// # Example /// # Example
/// ///
/// ```rust /// ```rust
/// use std::hashmap::HashMap; /// use collections::HashMap;
/// ///
/// // map some strings to vectors of strings /// // map some strings to vectors of strings
/// let mut map = HashMap::<~str, ~[~str]>::new(); /// let mut map = HashMap::<~str, ~[~str]>::new();
@ -613,6 +609,10 @@ impl<A: fmt::Show + Hash + Eq, B: fmt::Show> fmt::Show for HashMap<A, B> {
} }
} }
impl<K: fmt::Show + Hash + Eq, V: fmt::Show> ToStr for HashMap<K, V> {
fn to_str(&self) -> ~str { format!("{}", *self) }
}
/// HashMap iterator /// HashMap iterator
#[deriving(Clone)] #[deriving(Clone)]
pub struct Entries<'a, K, V> { pub struct Entries<'a, K, V> {
@ -891,6 +891,10 @@ impl<A: fmt::Show + Hash + Eq> fmt::Show for HashSet<A> {
} }
} }
impl<A: fmt::Show + Hash + Eq> ToStr for HashSet<A> {
fn to_str(&self) -> ~str { format!("{}", *self) }
}
impl<K: Eq + Hash> FromIterator<K> for HashSet<K> { impl<K: Eq + Hash> FromIterator<K> for HashSet<K> {
fn from_iterator<T: Iterator<K>>(iter: &mut T) -> HashSet<K> { fn from_iterator<T: Iterator<K>>(iter: &mut T) -> HashSet<K> {
let (lower, _) = iter.size_hint(); let (lower, _) = iter.size_hint();
@ -919,12 +923,75 @@ pub type SetAlgebraItems<'a, T> =
FilterMap<'static,(&'a HashSet<T>, &'a T), &'a T, FilterMap<'static,(&'a HashSet<T>, &'a T), &'a T,
Zip<Repeat<&'a HashSet<T>>,SetItems<'a,T>>>; Zip<Repeat<&'a HashSet<T>>,SetItems<'a,T>>>;
impl<
E: Encoder,
K: Encodable<E> + Hash + IterBytes + Eq,
V: Encodable<E>
> Encodable<E> for HashMap<K, V> {
fn encode(&self, e: &mut E) {
e.emit_map(self.len(), |e| {
let mut i = 0;
for (key, val) in self.iter() {
e.emit_map_elt_key(i, |e| key.encode(e));
e.emit_map_elt_val(i, |e| val.encode(e));
i += 1;
}
})
}
}
impl<
D: Decoder,
K: Decodable<D> + Hash + IterBytes + Eq,
V: Decodable<D>
> Decodable<D> for HashMap<K, V> {
fn decode(d: &mut D) -> HashMap<K, V> {
d.read_map(|d, len| {
let mut map = HashMap::with_capacity(len);
for i in range(0u, len) {
let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
map.insert(key, val);
}
map
})
}
}
impl<
S: Encoder,
T: Encodable<S> + Hash + IterBytes + Eq
> Encodable<S> for HashSet<T> {
fn encode(&self, s: &mut S) {
s.emit_seq(self.len(), |s| {
let mut i = 0;
for e in self.iter() {
s.emit_seq_elt(i, |s| e.encode(s));
i += 1;
}
})
}
}
impl<
D: Decoder,
T: Decodable<D> + Hash + IterBytes + Eq
> Decodable<D> for HashSet<T> {
fn decode(d: &mut D) -> HashSet<T> {
d.read_seq(|d, len| {
let mut set = HashSet::with_capacity(len);
for i in range(0u, len) {
set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
}
set
})
}
}
#[cfg(test)] #[cfg(test)]
mod test_map { mod test_map {
use prelude::*; use super::{HashMap, HashSet};
use super::*; use std::fmt;
use fmt;
#[test] #[test]
fn test_create_capacity_zero() { fn test_create_capacity_zero() {
@ -1180,14 +1247,49 @@ mod test_map {
assert!(table_str == ~"{1: s2, 3: s4}" || table_str == ~"{3: s4, 1: s2}"); assert!(table_str == ~"{1: s2, 3: s4}" || table_str == ~"{3: s4, 1: s2}");
assert_eq!(format!("{}", empty), ~"{}"); assert_eq!(format!("{}", empty), ~"{}");
} }
struct StructWithToStrWithoutEqOrHash {
value: int
}
impl fmt::Show for StructWithToStrWithoutEqOrHash {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f.buf, "s{}", self.value)
}
}
#[test]
fn test_hashset() {
let mut set: HashSet<int> = HashSet::new();
let empty_set: HashSet<int> = HashSet::new();
set.insert(1);
set.insert(2);
let set_str = set.to_str();
assert!(set_str == ~"{1, 2}" || set_str == ~"{2, 1}");
assert_eq!(empty_set.to_str(), ~"{}");
}
#[test]
fn test_hashmap() {
let mut table: HashMap<int, StructWithToStrWithoutEqOrHash> = HashMap::new();
let empty: HashMap<int, StructWithToStrWithoutEqOrHash> = HashMap::new();
table.insert(3, StructWithToStrWithoutEqOrHash { value: 4 });
table.insert(1, StructWithToStrWithoutEqOrHash { value: 2 });
let table_str = table.to_str();
assert!(table_str == ~"{1: s2, 3: s4}" || table_str == ~"{3: s4, 1: s2}");
assert_eq!(empty.to_str(), ~"{}");
}
} }
#[cfg(test)] #[cfg(test)]
mod test_set { mod test_set {
use super::*; use super::HashSet;
use prelude::*;
use container::Container;
use vec::ImmutableEqVector;
#[test] #[test]
fn test_disjoint() { fn test_disjoint() {

View file

@ -27,21 +27,25 @@ pub use btree::BTree;
pub use deque::Deque; pub use deque::Deque;
pub use dlist::DList; pub use dlist::DList;
pub use enum_set::EnumSet; pub use enum_set::EnumSet;
pub use hashmap::{HashMap, HashSet};
pub use list::List; pub use list::List;
pub use lru_cache::LruCache; pub use lru_cache::LruCache;
pub use priority_queue::PriorityQueue; pub use priority_queue::PriorityQueue;
pub use ringbuf::RingBuf; pub use ringbuf::RingBuf;
pub use smallintmap::SmallIntMap; pub use smallintmap::SmallIntMap;
pub use treemap::{TreeMap, TreeSet}; pub use treemap::{TreeMap, TreeSet};
pub use trie::{TrieMap, TrieSet};
pub mod bitv; pub mod bitv;
pub mod btree; pub mod btree;
pub mod deque; pub mod deque;
pub mod dlist; pub mod dlist;
pub mod enum_set; pub mod enum_set;
pub mod hashmap;
pub mod list; pub mod list;
pub mod lru_cache; pub mod lru_cache;
pub mod priority_queue; pub mod priority_queue;
pub mod ringbuf; pub mod ringbuf;
pub mod smallintmap; pub mod smallintmap;
pub mod treemap; pub mod treemap;
pub mod trie;

View file

@ -38,11 +38,12 @@
//! ``` //! ```
use std::container::Container; use std::container::Container;
use std::hashmap::HashMap;
use std::to_bytes::Cb; use std::to_bytes::Cb;
use std::ptr; use std::ptr;
use std::cast; use std::cast;
use HashMap;
struct KeyRef<K> { k: *K } struct KeyRef<K> { k: *K }
struct LruEntry<K, V> { struct LruEntry<K, V> {

View file

@ -10,15 +10,13 @@
//! Ordered containers with integer keys, implemented as radix tries (`TrieSet` and `TrieMap` types) //! Ordered containers with integer keys, implemented as radix tries (`TrieSet` and `TrieMap` types)
use option::{None, Option, Some}; use std::mem;
use container::{Container, Map, Mutable, MutableMap}; use std::uint;
use iter::{Extendable, FromIterator, Iterator}; use std::mem::init;
use mem; use std::vec;
use uint; use std::vec::{Items, MutItems};
use mem::init;
use vec; use serialize::{Encodable, Decodable, Encoder, Decoder};
use ptr::RawPtr;
use vec::{ImmutableVector, Items, MutableVector, MutItems, OwnedVector};
// FIXME: #5244: need to manually update the TrieNode constructor // FIXME: #5244: need to manually update the TrieNode constructor
static SHIFT: uint = 4; static SHIFT: uint = 4;
@ -622,32 +620,83 @@ impl<'a> Iterator<uint> for SetItems<'a> {
} }
} }
#[cfg(test)] impl<
pub fn check_integrity<T>(trie: &TrieNode<T>) { E: Encoder,
assert!(trie.count != 0); V: Encodable<E>
> Encodable<E> for TrieMap<V> {
let mut sum = 0; fn encode(&self, e: &mut E) {
e.emit_map(self.len(), |e| {
for x in trie.children.iter() { for (i, (key, val)) in self.iter().enumerate() {
match *x { e.emit_map_elt_key(i, |e| key.encode(e));
Nothing => (), e.emit_map_elt_val(i, |e| val.encode(e));
Internal(ref y) => { }
check_integrity(&**y); });
sum += 1
}
External(_, _) => { sum += 1 }
}
} }
}
assert_eq!(sum, trie.count); impl<
D: Decoder,
V: Decodable<D>
> Decodable<D> for TrieMap<V> {
fn decode(d: &mut D) -> TrieMap<V> {
d.read_map(|d, len| {
let mut map = TrieMap::new();
for i in range(0u, len) {
let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
map.insert(key, val);
}
map
})
}
}
impl<S: Encoder> Encodable<S> for TrieSet {
fn encode(&self, s: &mut S) {
s.emit_seq(self.len(), |s| {
for (i, e) in self.iter().enumerate() {
s.emit_seq_elt(i, |s| e.encode(s));
}
})
}
}
impl<D: Decoder> Decodable<D> for TrieSet {
fn decode(d: &mut D) -> TrieSet {
d.read_seq(|d, len| {
let mut set = TrieSet::new();
for i in range(0u, len) {
set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
}
set
})
}
} }
#[cfg(test)] #[cfg(test)]
mod test_map { mod test_map {
use super::*; use super::{TrieMap, TrieNode, Internal, External};
use prelude::*; use std::iter::range_step;
use iter::range_step; use std::uint;
use uint;
fn check_integrity<T>(trie: &TrieNode<T>) {
assert!(trie.count != 0);
let mut sum = 0;
for x in trie.children.iter() {
match *x {
Nothing => (),
Internal(ref y) => {
check_integrity(&**y);
sum += 1
}
External(_, _) => { sum += 1 }
}
}
assert_eq!(sum, trie.count);
}
#[test] #[test]
fn test_find_mut() { fn test_find_mut() {
@ -903,10 +952,9 @@ mod test_map {
#[cfg(test)] #[cfg(test)]
mod bench_map { mod bench_map {
extern crate test; extern crate test;
use super::TrieMap;
use std::rand::{weak_rng, Rng};
use self::test::BenchHarness; use self::test::BenchHarness;
use super::*;
use prelude::*;
use rand::{weak_rng, Rng};
#[bench] #[bench]
fn bench_iter_small(bh: &mut BenchHarness) { fn bench_iter_small(bh: &mut BenchHarness) {
@ -1011,9 +1059,8 @@ mod bench_map {
#[cfg(test)] #[cfg(test)]
mod test_set { mod test_set {
use super::*; use super::TrieSet;
use prelude::*; use std::uint;
use uint;
#[test] #[test]
fn test_sane_chunk() { fn test_sane_chunk() {

View file

@ -235,7 +235,7 @@ fn main() {
use std::char; use std::char;
use std::f64; use std::f64;
use std::hashmap::HashMap; use collections::HashMap;
use std::io; use std::io;
use std::io::MemWriter; use std::io::MemWriter;
use std::num; use std::num;

View file

@ -12,10 +12,10 @@
use std::cmp; use std::cmp;
use std::hash_old::Hash; use std::hash_old::Hash;
use std::hashmap;
use std::io; use std::io;
use std::mem; use std::mem;
use std::num; use std::num;
use collections::hashmap;
// NB: this can probably be rewritten in terms of num::Num // NB: this can probably be rewritten in terms of num::Num
// to be less f64-specific. // to be less f64-specific.

View file

@ -14,7 +14,7 @@
use std::io::BufReader; use std::io::BufReader;
use std::cmp::Eq; use std::cmp::Eq;
use std::hashmap::HashMap; use collections::HashMap;
use std::to_bytes; use std::to_bytes;
use std::uint; use std::uint;
@ -957,7 +957,7 @@ mod tests {
use super::*; use super::*;
use std::hashmap::HashMap; use collections::HashMap;
#[test] #[test]
fn test_url_parse() { fn test_url_parse() {

View file

@ -49,7 +49,6 @@
#[allow(non_camel_case_types)]; #[allow(non_camel_case_types)];
use std::comm::Data; use std::comm::Data;
use std::hashmap::HashMap;
use std::libc; use std::libc;
use std::mem; use std::mem;
use std::os; use std::os;
@ -105,7 +104,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
// sorted list, and dead timers are those which have expired, but ownership // sorted list, and dead timers are those which have expired, but ownership
// hasn't yet been transferred back to the timer itself. // hasn't yet been transferred back to the timer itself.
let mut active: ~[~Inner] = ~[]; let mut active: ~[~Inner] = ~[];
let mut dead = HashMap::new(); let mut dead = ~[];
// inserts a timer into an array of timers (sorted by firing time) // inserts a timer into an array of timers (sorted by firing time)
fn insert(t: ~Inner, active: &mut ~[~Inner]) { fn insert(t: ~Inner, active: &mut ~[~Inner]) {
@ -116,7 +115,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
} }
// signals the first requests in the queue, possible re-enqueueing it. // signals the first requests in the queue, possible re-enqueueing it.
fn signal(active: &mut ~[~Inner], dead: &mut HashMap<uint, ~Inner>) { fn signal(active: &mut ~[~Inner], dead: &mut ~[(uint, ~Inner)]) {
let mut timer = match active.shift() { let mut timer = match active.shift() {
Some(timer) => timer, None => return Some(timer) => timer, None => return
}; };
@ -127,7 +126,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
insert(timer, active); insert(timer, active);
} else { } else {
drop(chan); drop(chan);
dead.insert(timer.id, timer); dead.push((timer.id, timer));
} }
} }
@ -172,8 +171,12 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
Data(NewTimer(timer)) => insert(timer, &mut active), Data(NewTimer(timer)) => insert(timer, &mut active),
Data(RemoveTimer(id, ack)) => { Data(RemoveTimer(id, ack)) => {
match dead.pop(&id) { match dead.iter().position(|&(i, _)| id == i) {
Some(i) => { ack.send(i); continue } Some(i) => {
let (_, i) = dead.remove(i).unwrap();
ack.send(i);
continue
}
None => {} None => {}
} }
let i = active.iter().position(|i| i.id == id); let i = active.iter().position(|i| i.id == id);

View file

@ -35,7 +35,6 @@ use std::libc;
use std::ptr; use std::ptr;
use std::os; use std::os;
use std::rt::rtio; use std::rt::rtio;
use std::hashmap::HashMap;
use std::mem; use std::mem;
use io::file::FileDesc; use io::file::FileDesc;
@ -78,7 +77,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
add(efd, input); add(efd, input);
let events: [imp::epoll_event, ..16] = unsafe { mem::init() }; let events: [imp::epoll_event, ..16] = unsafe { mem::init() };
let mut map: HashMap<libc::c_int, (Chan<()>, bool)> = HashMap::new(); let mut list: ~[(libc::c_int, Chan<()>, bool)] = ~[];
'outer: loop { 'outer: loop {
let n = match unsafe { let n = match unsafe {
imp::epoll_wait(efd, events.as_ptr(), imp::epoll_wait(efd, events.as_ptr(),
@ -107,13 +106,17 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
// FIXME: should this perform a send() this number of // FIXME: should this perform a send() this number of
// times? // times?
let _ = FileDesc::new(fd, false).inner_read(bits).unwrap(); let _ = FileDesc::new(fd, false).inner_read(bits).unwrap();
let remove = { let (remove, i) = {
match map.find(&fd).expect("fd unregistered") { match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
&(ref c, oneshot) => !c.try_send(()) || oneshot Some(i) => {
let (_, ref c, oneshot) = list[i];
(!c.try_send(()) || oneshot, i)
}
None => fail!("fd not active: {}", fd),
} }
}; };
if remove { if remove {
map.remove(&fd); drop(list.remove(i));
del(efd, fd); del(efd, fd);
} }
} }
@ -128,8 +131,17 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
// If we haven't previously seen the file descriptor, then // If we haven't previously seen the file descriptor, then
// we need to add it to the epoll set. // we need to add it to the epoll set.
if map.insert(fd, (chan, one)) { match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
add(efd, fd); Some(i) => {
drop(mem::replace(&mut list[i], (fd, chan, one)));
}
None => {
match list.iter().position(|&(f, _, _)| f >= fd) {
Some(i) => list.insert(i, (fd, chan, one)),
None => list.push((fd, chan, one)),
}
add(efd, fd);
}
} }
// Update the timerfd's time value now that we have control // Update the timerfd's time value now that we have control
@ -141,14 +153,18 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
} }
Data(RemoveTimer(fd, chan)) => { Data(RemoveTimer(fd, chan)) => {
if map.remove(&fd) { match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
del(efd, fd); Some(i) => {
drop(list.remove(i));
del(efd, fd);
}
None => {}
} }
chan.send(()); chan.send(());
} }
Data(Shutdown) => { Data(Shutdown) => {
assert!(map.len() == 0); assert!(list.len() == 0);
break 'outer; break 'outer;
} }

View file

@ -13,7 +13,7 @@ use driver::session;
use metadata::cstore; use metadata::cstore;
use metadata::filesearch; use metadata::filesearch;
use std::hashmap::HashSet; use collections::HashSet;
use std::{os, vec}; use std::{os, vec};
use syntax::abi; use syntax::abi;

View file

@ -31,12 +31,12 @@ use extra::json;
use serialize::Encodable; use serialize::Encodable;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::{HashMap,HashSet};
use std::io; use std::io;
use std::io::fs; use std::io::fs;
use std::io::MemReader; use std::io::MemReader;
use std::os; use std::os;
use std::vec; use std::vec;
use collections::{HashMap, HashSet};
use getopts::{optopt, optmulti, optflag, optflagopt}; use getopts::{optopt, optmulti, optflag, optflagopt};
use getopts; use getopts;
use syntax::ast; use syntax::ast;

View file

@ -26,7 +26,7 @@ use syntax::{abi, ast, codemap};
use syntax; use syntax;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::{HashMap,HashSet}; use collections::{HashMap,HashSet};
pub struct Config { pub struct Config {
os: abi::Os, os: abi::Os,

View file

@ -13,7 +13,7 @@
use std::c_str::ToCStr; use std::c_str::ToCStr;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use std::libc::{c_uint, c_ushort, c_void, free}; use std::libc::{c_uint, c_ushort, c_void, free};
use std::str::raw::from_c_str; use std::str::raw::from_c_str;

View file

@ -21,7 +21,7 @@ use metadata::loader;
use metadata::loader::Os; use metadata::loader::Os;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast; use syntax::ast;
use syntax::abi; use syntax::abi;
use syntax::attr; use syntax::attr;

View file

@ -17,7 +17,7 @@ use metadata::decoder;
use metadata::loader; use metadata::loader;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast; use syntax::ast;
use syntax::parse::token::IdentInterner; use syntax::parse::token::IdentInterner;

View file

@ -27,9 +27,9 @@ use serialize::Encodable;
use std::cast; use std::cast;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hash_old::Hash; use std::hash_old::Hash;
use std::hashmap::{HashMap, HashSet};
use std::io::MemWriter; use std::io::MemWriter;
use std::str; use std::str;
use collections::{HashMap, HashSet};
use syntax::abi::AbiSet; use syntax::abi::AbiSet;
use syntax::ast::*; use syntax::ast::*;
use syntax::ast; use syntax::ast;

View file

@ -14,7 +14,7 @@ use std::cell::RefCell;
use std::option; use std::option;
use std::os; use std::os;
use std::io::fs; use std::io::fs;
use std::hashmap::HashSet; use collections::HashSet;
pub enum FileMatch { FileMatches, FileDoesntMatch } pub enum FileMatch { FileMatches, FileDoesntMatch }

View file

@ -26,13 +26,13 @@ use syntax::attr::AttrMetaMethods;
use std::c_str::ToCStr; use std::c_str::ToCStr;
use std::cast; use std::cast;
use std::hashmap::{HashMap, HashSet};
use std::cmp; use std::cmp;
use std::io; use std::io;
use std::os::consts::{macos, freebsd, linux, android, win32}; use std::os::consts::{macos, freebsd, linux, android, win32};
use std::str; use std::str;
use std::vec; use std::vec;
use collections::{HashMap, HashSet};
use flate; use flate;
use time; use time;

View file

@ -14,7 +14,7 @@
#[allow(non_camel_case_types)]; #[allow(non_camel_case_types)];
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use std::io; use std::io;
use std::io::MemWriter; use std::io::MemWriter;
use std::str; use std::str;

View file

@ -21,7 +21,7 @@ use middle::dataflow::DataFlowOperator;
use util::ppaux::{note_and_explain_region, Repr, UserString}; use util::ppaux::{note_and_explain_region, Repr, UserString};
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
use std::ops::{BitOr, BitAnd}; use std::ops::{BitOr, BitAnd};
use std::result::{Result}; use std::result::{Result};
use syntax::ast; use syntax::ast;

View file

@ -16,8 +16,8 @@ comments in the section "Moves and initialization" and in `doc.rs`.
*/ */
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::{HashMap, HashSet};
use std::uint; use std::uint;
use collections::{HashMap, HashSet};
use middle::borrowck::*; use middle::borrowck::*;
use middle::dataflow::DataFlowContext; use middle::dataflow::DataFlowContext;
use middle::dataflow::DataFlowOperator; use middle::dataflow::DataFlowOperator;

View file

@ -12,7 +12,7 @@ use middle::cfg::*;
use middle::graph; use middle::graph;
use middle::typeck; use middle::typeck;
use middle::ty; use middle::ty;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast; use syntax::ast;
use syntax::ast_util; use syntax::ast_util;
use syntax::opt_vec; use syntax::opt_vec;

View file

@ -18,7 +18,7 @@ Uses `Graph` as the underlying representation.
use middle::graph; use middle::graph;
use middle::ty; use middle::ty;
use middle::typeck; use middle::typeck;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast; use syntax::ast;
use syntax::opt_vec::OptVec; use syntax::opt_vec::OptVec;

View file

@ -24,7 +24,7 @@ use syntax::visit;
use syntax::{ast, ast_map, ast_util}; use syntax::{ast, ast_map, ast_util};
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use std::rc::Rc; use std::rc::Rc;
// //

View file

@ -20,7 +20,7 @@
use std::io; use std::io;
use std::uint; use std::uint;
use std::vec; use std::vec;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast; use syntax::ast;
use syntax::ast_util; use syntax::ast_util;
use syntax::ast_util::IdRange; use syntax::ast_util::IdRange;

View file

@ -17,7 +17,7 @@ use middle::privacy;
use middle::ty; use middle::ty;
use middle::typeck; use middle::typeck;
use std::hashmap::HashSet; use collections::HashSet;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use syntax::ast_util::{local_def, def_id_of_def, is_local}; use syntax::ast_util::{local_def, def_id_of_def, is_local};

View file

@ -16,7 +16,7 @@
use middle::resolve; use middle::resolve;
use middle::ty; use middle::ty;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::{ast, ast_util}; use syntax::{ast, ast_util};
use syntax::visit; use syntax::visit;

View file

@ -30,7 +30,7 @@ use syntax::parse::token::InternedString;
use syntax::visit::Visitor; use syntax::visit::Visitor;
use syntax::visit; use syntax::visit;
use std::hashmap::HashMap; use collections::HashMap;
use std::iter::Enumerate; use std::iter::Enumerate;
use std::vec; use std::vec;

View file

@ -49,7 +49,7 @@ use std::to_str::ToStr;
use util::ppaux::{ty_to_str}; use util::ppaux::{ty_to_str};
use std::cmp; use std::cmp;
use std::hashmap::HashMap; use collections::HashMap;
use std::i16; use std::i16;
use std::i32; use std::i32;
use std::i64; use std::i64;

View file

@ -111,7 +111,7 @@ use middle::moves;
use std::cast::transmute; use std::cast::transmute;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
use std::io; use std::io;
use std::str; use std::str;
use std::to_str; use std::to_str;

View file

@ -137,8 +137,8 @@ use util::common::indenter;
use util::ppaux::UserString; use util::ppaux::UserString;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::{HashSet, HashMap};
use std::rc::Rc; use std::rc::Rc;
use collections::{HashSet, HashMap};
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_util; use syntax::ast_util;
use syntax::visit; use syntax::visit;

View file

@ -11,7 +11,7 @@
use middle::resolve; use middle::resolve;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_util::{path_to_ident, walk_pat}; use syntax::ast_util::{path_to_ident, walk_pat};
use syntax::codemap::Span; use syntax::codemap::Span;

View file

@ -12,8 +12,8 @@
//! outside their scopes. This pass will also generate a set of exported items //! outside their scopes. This pass will also generate a set of exported items
//! which are available for use externally when compiled as a library. //! which are available for use externally when compiled as a library.
use std::hashmap::{HashSet, HashMap};
use std::mem::replace; use std::mem::replace;
use collections::{HashSet, HashMap};
use metadata::csearch; use metadata::csearch;
use middle::resolve; use middle::resolve;

View file

@ -20,7 +20,7 @@ use middle::typeck;
use middle::privacy; use middle::privacy;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashSet; use collections::HashSet;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use syntax::ast_util::{def_id_of_def, is_local}; use syntax::ast_util::{def_id_of_def, is_local};

View file

@ -26,7 +26,7 @@ use middle::ty::{FreeRegion};
use middle::ty; use middle::ty;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::{ast, visit}; use syntax::{ast, visit};
use syntax::visit::{Visitor, FnKind}; use syntax::visit::{Visitor, FnKind};

View file

@ -31,8 +31,8 @@ use syntax::visit::Visitor;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::uint; use std::uint;
use std::hashmap::{HashMap, HashSet};
use std::mem::replace; use std::mem::replace;
use collections::{HashMap, HashSet};
// Definition mapping // Definition mapping
pub type DefMap = @RefCell<HashMap<NodeId,Def>>; pub type DefMap = @RefCell<HashMap<NodeId,Def>>;

View file

@ -19,7 +19,7 @@
use driver::session; use driver::session;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast; use syntax::ast;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::opt_vec::OptVec; use syntax::opt_vec::OptVec;

View file

@ -223,7 +223,7 @@ use util::common::indenter;
use util::ppaux::{Repr, vec_map_to_str}; use util::ppaux::{Repr, vec_map_to_str};
use std::cell::Cell; use std::cell::Cell;
use std::hashmap::HashMap; use collections::HashMap;
use std::vec; use std::vec;
use syntax::ast; use syntax::ast;
use syntax::ast::Ident; use syntax::ast::Ident;

View file

@ -74,7 +74,7 @@ use util::sha2::Sha256;
use arena::TypedArena; use arena::TypedArena;
use std::c_str::ToCStr; use std::c_str::ToCStr;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
use std::libc::c_uint; use std::libc::c_uint;
use std::local_data; use std::local_data;
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32}; use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};

View file

@ -17,8 +17,8 @@ use middle::trans::base;
use middle::trans::common::*; use middle::trans::common::*;
use middle::trans::machine::llalign_of_pref; use middle::trans::machine::llalign_of_pref;
use middle::trans::type_::Type; use middle::trans::type_::Type;
use std::hashmap::HashMap;
use std::libc::{c_uint, c_ulonglong, c_char}; use std::libc::{c_uint, c_ulonglong, c_char};
use collections::HashMap;
use syntax::codemap::Span; use syntax::codemap::Span;
pub struct Builder<'a> { pub struct Builder<'a> {

View file

@ -33,7 +33,7 @@ use util::ppaux::Repr;
use arena::TypedArena; use arena::TypedArena;
use std::c_str::ToCStr; use std::c_str::ToCStr;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
use std::libc::{c_uint, c_longlong, c_ulonglong, c_char}; use std::libc::{c_uint, c_longlong, c_ulonglong, c_char};
use syntax::ast::Ident; use syntax::ast::Ident;
use syntax::ast; use syntax::ast;

View file

@ -29,9 +29,9 @@ use util::sha2::Sha256;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::c_str::ToCStr; use std::c_str::ToCStr;
use std::hashmap::{HashMap, HashSet};
use std::local_data; use std::local_data;
use std::libc::c_uint; use std::libc::c_uint;
use collections::{HashMap, HashSet};
use syntax::ast; use syntax::ast;
use syntax::parse::token::InternedString; use syntax::parse::token::InternedString;

View file

@ -142,8 +142,8 @@ use util::ppaux;
use std::c_str::{CString, ToCStr}; use std::c_str::{CString, ToCStr};
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
use std::hashmap::HashSet; use collections::HashSet;
use std::libc::{c_uint, c_ulonglong, c_longlong}; use std::libc::{c_uint, c_ulonglong, c_longlong};
use std::ptr; use std::ptr;
use std::sync::atomics; use std::sync::atomics;

View file

@ -70,7 +70,7 @@ use middle::trans::machine::llsize_of;
use middle::trans::type_::Type; use middle::trans::type_::Type;
use std::hashmap::HashMap; use collections::HashMap;
use std::vec; use std::vec;
use syntax::ast; use syntax::ast;
use syntax::ast_map; use syntax::ast_map;

View file

@ -33,12 +33,12 @@ use util::common::{indenter};
use std::cast; use std::cast;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::cmp; use std::cmp;
use std::hashmap::{HashMap, HashSet};
use std::ops; use std::ops;
use std::rc::Rc; use std::rc::Rc;
use std::to_bytes; use std::to_bytes;
use std::to_str::ToStr; use std::to_str::ToStr;
use std::vec; use std::vec;
use collections::{HashMap, HashSet};
use syntax::ast::*; use syntax::ast::*;
use syntax::ast_util::{is_local, lit_is_str}; use syntax::ast_util::{is_local, lit_is_str};
use syntax::ast_util; use syntax::ast_util;
@ -460,7 +460,7 @@ pub struct param_ty {
} }
/// Representation of regions: /// Representation of regions:
#[deriving(Clone, Eq, IterBytes, Encodable, Decodable, ToStr)] #[deriving(Clone, Eq, IterBytes, Encodable, Decodable, ToStr, Show)]
pub enum Region { pub enum Region {
// Region bound in a type or fn declaration which will be // Region bound in a type or fn declaration which will be
// substituted 'early' -- that is, at the same time when type // substituted 'early' -- that is, at the same time when type
@ -620,13 +620,13 @@ impl Region {
} }
} }
#[deriving(Clone, Eq, TotalOrd, TotalEq, IterBytes, Encodable, Decodable, ToStr)] #[deriving(Clone, Eq, TotalOrd, TotalEq, IterBytes, Encodable, Decodable, ToStr, Show)]
pub struct FreeRegion { pub struct FreeRegion {
scope_id: NodeId, scope_id: NodeId,
bound_region: BoundRegion bound_region: BoundRegion
} }
#[deriving(Clone, Eq, TotalEq, TotalOrd, IterBytes, Encodable, Decodable, ToStr)] #[deriving(Clone, Eq, TotalEq, TotalOrd, IterBytes, Encodable, Decodable, ToStr, Show)]
pub enum BoundRegion { pub enum BoundRegion {
/// An anonymous region parameter for a given fn (&T) /// An anonymous region parameter for a given fn (&T)
BrAnon(uint), BrAnon(uint),
@ -869,7 +869,7 @@ pub struct IntVid(uint);
#[deriving(Clone, Eq, IterBytes)] #[deriving(Clone, Eq, IterBytes)]
pub struct FloatVid(uint); pub struct FloatVid(uint);
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)] #[deriving(Clone, Eq, Encodable, Decodable, IterBytes, Show)]
pub struct RegionVid { pub struct RegionVid {
id: uint id: uint
} }
@ -881,7 +881,7 @@ pub enum InferTy {
FloatVar(FloatVid) FloatVar(FloatVid)
} }
#[deriving(Clone, Encodable, Decodable, IterBytes, ToStr)] #[deriving(Clone, Encodable, Decodable, IterBytes, ToStr, Show)]
pub enum InferRegion { pub enum InferRegion {
ReVar(RegionVid), ReVar(RegionVid),
ReSkolemized(uint, BoundRegion) ReSkolemized(uint, BoundRegion)

View file

@ -19,7 +19,7 @@ use middle::typeck::check::{structure_of, valid_range_bounds};
use middle::typeck::infer; use middle::typeck::infer;
use middle::typeck::require_same_types; use middle::typeck::require_same_types;
use std::hashmap::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use syntax::ast; use syntax::ast;
use syntax::ast_util; use syntax::ast_util;
use syntax::parse::token; use syntax::parse::token;

View file

@ -98,7 +98,7 @@ use util::common::indenter;
use util::ppaux::Repr; use util::ppaux::Repr;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashSet; use collections::HashSet;
use std::result; use std::result;
use std::vec; use std::vec;
use syntax::ast::{DefId, SelfValue, SelfRegion}; use syntax::ast::{DefId, SelfValue, SelfRegion};

View file

@ -114,7 +114,7 @@ use util::ppaux;
use util::ppaux::{UserString, Repr}; use util::ppaux::{UserString, Repr};
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
use std::mem::replace; use std::mem::replace;
use std::result; use std::result;
use std::vec; use std::vec;

View file

@ -13,7 +13,7 @@
use middle::ty; use middle::ty;
use middle::ty_fold; use middle::ty_fold;
use middle::ty_fold::TypeFolder; use middle::ty_fold::TypeFolder;
use std::hashmap::HashMap; use collections::HashMap;
use util::ppaux::Repr; use util::ppaux::Repr;
use util::ppaux; use util::ppaux;
@ -39,7 +39,7 @@ pub fn replace_bound_regions_in_fn_sig(
}); });
ty_fold::super_fold_sig(&mut f, fn_sig) ty_fold::super_fold_sig(&mut f, fn_sig)
}; };
debug!("resulting map: {}", map.to_str()); debug!("resulting map: {}", map);
(map, fn_sig) (map, fn_sig)
} }

View file

@ -27,7 +27,7 @@ use util::ppaux;
use util::ppaux::Repr; use util::ppaux::Repr;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashSet; use collections::HashSet;
use std::result; use std::result;
use syntax::ast; use syntax::ast;
use syntax::ast_util; use syntax::ast_util;

View file

@ -47,7 +47,7 @@ use syntax::parse::token;
use syntax::visit; use syntax::visit;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashSet; use collections::HashSet;
use std::rc::Rc; use std::rc::Rc;
use std::vec; use std::vec;

View file

@ -24,7 +24,7 @@ use middle::typeck::infer::fold_regions_in_sig;
use syntax::ast::{Many, Once, MutImmutable, MutMutable}; use syntax::ast::{Many, Once, MutImmutable, MutMutable};
use syntax::ast::{ExternFn, ImpureFn, UnsafeFn, NodeId}; use syntax::ast::{ExternFn, ImpureFn, UnsafeFn, NodeId};
use syntax::ast::{Onceness, Purity}; use syntax::ast::{Onceness, Purity};
use std::hashmap::HashMap; use collections::HashMap;
use util::common::{indenter}; use util::common::{indenter};
use util::ppaux::mt_to_str; use util::ppaux::mt_to_str;

View file

@ -43,7 +43,7 @@ use middle::typeck::infer::lub::Lub;
use middle::typeck::infer::unify::*; use middle::typeck::infer::unify::*;
use middle::typeck::infer::sub::Sub; use middle::typeck::infer::sub::Sub;
use middle::typeck::infer::to_str::InferStr; use middle::typeck::infer::to_str::InferStr;
use std::hashmap::HashMap; use collections::HashMap;
use util::common::indenter; use util::common::indenter;
pub trait LatticeValue { pub trait LatticeValue {

View file

@ -21,7 +21,7 @@ use middle::typeck::infer::to_str::InferStr;
use middle::typeck::infer::{cres, InferCtxt}; use middle::typeck::infer::{cres, InferCtxt};
use middle::typeck::infer::fold_regions_in_sig; use middle::typeck::infer::fold_regions_in_sig;
use middle::typeck::infer::{TypeTrace, Subtype}; use middle::typeck::infer::{TypeTrace, Subtype};
use std::hashmap::HashMap; use collections::HashMap;
use syntax::ast::{Many, Once, NodeId}; use syntax::ast::{Many, Once, NodeId};
use syntax::ast::{ExternFn, ImpureFn, UnsafeFn}; use syntax::ast::{ExternFn, ImpureFn, UnsafeFn};
use syntax::ast::{Onceness, Purity}; use syntax::ast::{Onceness, Purity};

View file

@ -37,7 +37,7 @@ use middle::typeck::infer::to_str::InferStr;
use middle::typeck::infer::unify::{ValsAndBindings, Root}; use middle::typeck::infer::unify::{ValsAndBindings, Root};
use middle::typeck::infer::error_reporting::ErrorReporting; use middle::typeck::infer::error_reporting::ErrorReporting;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
use std::result; use std::result;
use std::vec; use std::vec;
use syntax::ast::{MutImmutable, MutMutable}; use syntax::ast::{MutImmutable, MutMutable};

View file

@ -25,9 +25,9 @@ use util::common::indenter;
use util::ppaux::{Repr}; use util::ppaux::{Repr};
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::{HashMap, HashSet};
use std::uint; use std::uint;
use std::vec; use std::vec;
use collections::{HashMap, HashSet};
use syntax::ast; use syntax::ast;
use syntax::opt_vec; use syntax::opt_vec;
use syntax::opt_vec::OptVec; use syntax::opt_vec::OptVec;

View file

@ -70,7 +70,7 @@ use util::ppaux::Repr;
use util::ppaux; use util::ppaux;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use std::rc::Rc; use std::rc::Rc;
use collections::List; use collections::List;
use collections::list; use collections::list;

View file

@ -192,7 +192,7 @@ represents the "variance transform" as defined in the paper:
*/ */
use std::hashmap::HashMap; use collections::HashMap;
use arena; use arena;
use arena::Arena; use arena::Arena;
use middle::ty; use middle::ty;

View file

@ -21,7 +21,7 @@ use syntax;
use std::cell::RefCell; use std::cell::RefCell;
use std::os; use std::os;
use std::local_data; use std::local_data;
use std::hashmap::{HashSet}; use collections::HashSet;
use visit_ast::RustdocVisitor; use visit_ast::RustdocVisitor;
use clean; use clean;

View file

@ -34,12 +34,12 @@
//! both occur before the crate is rendered. //! both occur before the crate is rendered.
use std::fmt; use std::fmt;
use std::hashmap::{HashMap, HashSet};
use std::local_data; use std::local_data;
use std::io; use std::io;
use std::io::{fs, File, BufferedWriter}; use std::io::{fs, File, BufferedWriter};
use std::str; use std::str;
use std::vec; use std::vec;
use collections::{HashMap, HashSet};
use sync::Arc; use sync::Arc;
use extra::json::ToJson; use extra::json::ToJson;

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
use std::cmp; use std::cmp;
use std::hashmap::HashSet; use collections::HashSet;
use std::local_data; use std::local_data;
use std::uint; use std::uint;
use syntax::ast; use syntax::ast;

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashSet; use collections::HashSet;
use std::local_data; use std::local_data;
use std::os; use std::os;
use std::run; use std::run;

View file

@ -14,10 +14,7 @@
Core encoding and decoding interfaces. Core encoding and decoding interfaces.
*/ */
use std::hash_old::Hash;
use std::hashmap::{HashMap, HashSet};
use std::rc::Rc; use std::rc::Rc;
use std::trie::{TrieMap, TrieSet};
use std::vec; use std::vec;
use std::vec_ng::Vec; use std::vec_ng::Vec;
@ -628,124 +625,6 @@ impl<
} }
} }
impl<
E: Encoder,
K: Encodable<E> + Hash + IterBytes + Eq,
V: Encodable<E>
> Encodable<E> for HashMap<K, V> {
fn encode(&self, e: &mut E) {
e.emit_map(self.len(), |e| {
let mut i = 0;
for (key, val) in self.iter() {
e.emit_map_elt_key(i, |e| key.encode(e));
e.emit_map_elt_val(i, |e| val.encode(e));
i += 1;
}
})
}
}
impl<
D: Decoder,
K: Decodable<D> + Hash + IterBytes + Eq,
V: Decodable<D>
> Decodable<D> for HashMap<K, V> {
fn decode(d: &mut D) -> HashMap<K, V> {
d.read_map(|d, len| {
let mut map = HashMap::with_capacity(len);
for i in range(0u, len) {
let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
map.insert(key, val);
}
map
})
}
}
impl<
S: Encoder,
T: Encodable<S> + Hash + IterBytes + Eq
> Encodable<S> for HashSet<T> {
fn encode(&self, s: &mut S) {
s.emit_seq(self.len(), |s| {
let mut i = 0;
for e in self.iter() {
s.emit_seq_elt(i, |s| e.encode(s));
i += 1;
}
})
}
}
impl<
D: Decoder,
T: Decodable<D> + Hash + IterBytes + Eq
> Decodable<D> for HashSet<T> {
fn decode(d: &mut D) -> HashSet<T> {
d.read_seq(|d, len| {
let mut set = HashSet::with_capacity(len);
for i in range(0u, len) {
set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
}
set
})
}
}
impl<
E: Encoder,
V: Encodable<E>
> Encodable<E> for TrieMap<V> {
fn encode(&self, e: &mut E) {
e.emit_map(self.len(), |e| {
for (i, (key, val)) in self.iter().enumerate() {
e.emit_map_elt_key(i, |e| key.encode(e));
e.emit_map_elt_val(i, |e| val.encode(e));
}
});
}
}
impl<
D: Decoder,
V: Decodable<D>
> Decodable<D> for TrieMap<V> {
fn decode(d: &mut D) -> TrieMap<V> {
d.read_map(|d, len| {
let mut map = TrieMap::new();
for i in range(0u, len) {
let key = d.read_map_elt_key(i, |d| Decodable::decode(d));
let val = d.read_map_elt_val(i, |d| Decodable::decode(d));
map.insert(key, val);
}
map
})
}
}
impl<S: Encoder> Encodable<S> for TrieSet {
fn encode(&self, s: &mut S) {
s.emit_seq(self.len(), |s| {
for (i, e) in self.iter().enumerate() {
s.emit_seq_elt(i, |s| e.encode(s));
}
})
}
}
impl<D: Decoder> Decodable<D> for TrieSet {
fn decode(d: &mut D) -> TrieSet {
d.read_seq(|d, len| {
let mut set = TrieSet::new();
for i in range(0u, len) {
set.insert(d.read_seq_elt(i, |d| Decodable::decode(d)));
}
set
})
}
}
// ___________________________________________________________________________ // ___________________________________________________________________________
// Helper routines // Helper routines
// //

View file

@ -20,12 +20,14 @@ definitions for a number of signals.
*/ */
use clone::Clone; use clone::Clone;
use result::{Ok, Err};
use comm::{Port, Chan}; use comm::{Port, Chan};
use container::{Map, MutableMap};
use hashmap;
use io; use io;
use iter::Iterator;
use mem::drop;
use option::{Some, None};
use result::{Ok, Err};
use rt::rtio::{IoFactory, LocalIo, RtioSignal}; use rt::rtio::{IoFactory, LocalIo, RtioSignal};
use vec::{ImmutableVector, OwnedVector};
#[repr(int)] #[repr(int)]
#[deriving(Eq, IterBytes)] #[deriving(Eq, IterBytes)]
@ -78,7 +80,7 @@ pub enum Signum {
/// ``` /// ```
pub struct Listener { pub struct Listener {
/// A map from signums to handles to keep the handles in memory /// A map from signums to handles to keep the handles in memory
priv handles: hashmap::HashMap<Signum, ~RtioSignal>, priv handles: ~[(Signum, ~RtioSignal)],
/// chan is where all the handles send signums, which are received by /// chan is where all the handles send signums, which are received by
/// the clients from port. /// the clients from port.
priv chan: Chan<Signum>, priv chan: Chan<Signum>,
@ -97,7 +99,7 @@ impl Listener {
Listener { Listener {
chan: chan, chan: chan,
port: port, port: port,
handles: hashmap::HashMap::new(), handles: ~[],
} }
} }
@ -118,14 +120,14 @@ impl Listener {
/// If this function fails to register a signal handler, then an error will /// If this function fails to register a signal handler, then an error will
/// be returned. /// be returned.
pub fn register(&mut self, signum: Signum) -> io::IoResult<()> { pub fn register(&mut self, signum: Signum) -> io::IoResult<()> {
if self.handles.contains_key(&signum) { if self.handles.iter().any(|&(sig, _)| sig == signum) {
return Ok(()); // self is already listening to signum, so succeed return Ok(()); // self is already listening to signum, so succeed
} }
match LocalIo::maybe_raise(|io| { match LocalIo::maybe_raise(|io| {
io.signal(signum, self.chan.clone()) io.signal(signum, self.chan.clone())
}) { }) {
Ok(handle) => { Ok(handle) => {
self.handles.insert(signum, handle); self.handles.push((signum, handle));
Ok(()) Ok(())
} }
Err(e) => Err(e) Err(e) => Err(e)
@ -137,7 +139,10 @@ impl Listener {
/// notification about the signal. If the signal has already been received, /// notification about the signal. If the signal has already been received,
/// it may still be returned by `recv`. /// it may still be returned by `recv`.
pub fn unregister(&mut self, signum: Signum) { pub fn unregister(&mut self, signum: Signum) {
self.handles.pop(&signum); match self.handles.iter().position(|&(i, _)| i == signum) {
Some(i) => drop(self.handles.remove(i)),
None => {}
}
} }
} }

View file

@ -11,7 +11,7 @@
//! # The Rust standard library //! # The Rust standard library
//! //!
//! The Rust standard library is a group of interrelated modules defining //! The Rust standard library is a group of interrelated modules defining
//! the core language traits, operations on built-in data types, collections, //! the core language traits, operations on built-in data types,
//! platform abstractions, the task scheduler, runtime support for language //! platform abstractions, the task scheduler, runtime support for language
//! features and other common functionality. //! features and other common functionality.
//! //!
@ -68,9 +68,9 @@
// When testing libstd, bring in libuv as the I/O backend so tests can print // When testing libstd, bring in libuv as the I/O backend so tests can print
// things and all of the std::io tests have an I/O interface to run on top // things and all of the std::io tests have an I/O interface to run on top
// of // of
#[cfg(test)] extern crate rustuv = "rustuv"; #[cfg(test)] extern crate rustuv;
#[cfg(test)] extern crate native = "native"; #[cfg(test)] extern crate native;
#[cfg(test)] extern crate green = "green"; #[cfg(test)] extern crate green;
// Make extra accessible for benchmarking // Make extra accessible for benchmarking
#[cfg(test)] extern crate extra = "extra"; #[cfg(test)] extern crate extra = "extra";
@ -156,9 +156,7 @@ pub mod any;
pub mod option; pub mod option;
pub mod result; pub mod result;
pub mod hashmap;
pub mod cell; pub mod cell;
pub mod trie;
/* Tasks and communication */ /* Tasks and communication */

View file

@ -70,7 +70,7 @@ hello // turns on all logging for the 'hello' module
info // turns on all info logging info // turns on all info logging
hello=debug // turns on debug logging for 'hello' hello=debug // turns on debug logging for 'hello'
hello=3 // turns on info logging for 'hello' hello=3 // turns on info logging for 'hello'
hello,std::hashmap // turns on hello, and std's hashmap logging hello,std::option // turns on hello, and std's option logging
error,hello=warn // turn on global error logging and also warn for hello error,hello=warn // turn on global error logging and also warn for hello
``` ```

View file

@ -8,13 +8,13 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use cmp::TotalOrd;
use container::MutableSet; use container::MutableSet;
use hashmap::HashSet;
use iter::Iterator; use iter::Iterator;
use option::{Some, None, Option}; use option::{Some, None, Option};
use ptr::RawPtr; use ptr::RawPtr;
use vec::ImmutableVector;
use rt::rtio::EventLoop; use rt::rtio::EventLoop;
use vec::{ImmutableVector, OwnedVector};
// Need to tell the linker on OS X to not barf on undefined symbols // Need to tell the linker on OS X to not barf on undefined symbols
// and instead look them up at runtime, which we need to resolve // and instead look them up at runtime, which we need to resolve
@ -89,28 +89,33 @@ fn version(crate_map: &CrateMap) -> i32 {
fn do_iter_crate_map<'a>( fn do_iter_crate_map<'a>(
crate_map: &'a CrateMap<'a>, crate_map: &'a CrateMap<'a>,
f: |&ModEntry|, f: |&ModEntry|,
visited: &mut HashSet<*CrateMap<'a>>) { visited: &mut ~[*CrateMap<'a>]) {
if visited.insert(crate_map as *CrateMap) { let raw = crate_map as *CrateMap<'a>;
match version(crate_map) { if visited.bsearch(|a| (*a as uint).cmp(&(raw as uint))).is_some() {
2 => { return
let (entries, children) = (crate_map.entries, crate_map.children); }
for entry in entries.iter() { match visited.iter().position(|i| *i as uint > raw as uint) {
f(entry); Some(i) => visited.insert(i, raw),
} None => visited.push(raw),
for child in children.iter() { }
do_iter_crate_map(*child, |x| f(x), visited);
} match version(crate_map) {
}, 2 => {
_ => fail!("invalid crate map version") let (entries, children) = (crate_map.entries, crate_map.children);
} for entry in entries.iter() {
f(entry);
}
for child in children.iter() {
do_iter_crate_map(*child, |x| f(x), visited);
}
},
_ => fail!("invalid crate map version")
} }
} }
/// Iterates recursively over `crate_map` and all child crate maps /// Iterates recursively over `crate_map` and all child crate maps
pub fn iter_crate_map<'a>(crate_map: &'a CrateMap<'a>, f: |&ModEntry|) { pub fn iter_crate_map<'a>(crate_map: &'a CrateMap<'a>, f: |&ModEntry|) {
// FIXME: use random numbers as keys from the OS-level RNG when there is a nice let mut v = ~[];
// way to do this
let mut v: HashSet<*CrateMap<'a>> = HashSet::with_capacity_and_keys(0, 0, 32);
do_iter_crate_map(crate_map, f, &mut v); do_iter_crate_map(crate_map, f, &mut v);
} }

View file

@ -16,11 +16,7 @@ The `ToStr` trait for converting to strings
use option::{Some, None}; use option::{Some, None};
use str::OwnedStr; use str::OwnedStr;
use hashmap::HashMap;
use hashmap::HashSet;
use hash_old::Hash;
use iter::Iterator; use iter::Iterator;
use cmp::Eq;
use vec::ImmutableVector; use vec::ImmutableVector;
/// A generic trait for converting a value to a string /// A generic trait for converting a value to a string
@ -40,46 +36,6 @@ impl ToStr for () {
fn to_str(&self) -> ~str { ~"()" } fn to_str(&self) -> ~str { ~"()" }
} }
impl<A:ToStr+Hash+Eq, B:ToStr> ToStr for HashMap<A, B> {
#[inline]
fn to_str(&self) -> ~str {
let mut acc = ~"{";
let mut first = true;
for (key, value) in self.iter() {
if first {
first = false;
}
else {
acc.push_str(", ");
}
acc.push_str(key.to_str());
acc.push_str(": ");
acc.push_str(value.to_str());
}
acc.push_char('}');
acc
}
}
impl<A:ToStr+Hash+Eq> ToStr for HashSet<A> {
#[inline]
fn to_str(&self) -> ~str {
let mut acc = ~"{";
let mut first = true;
for element in self.iter() {
if first {
first = false;
}
else {
acc.push_str(", ");
}
acc.push_str(element.to_str());
}
acc.push_char('}');
acc
}
}
impl<'a,A:ToStr> ToStr for &'a [A] { impl<'a,A:ToStr> ToStr for &'a [A] {
#[inline] #[inline]
fn to_str(&self) -> ~str { fn to_str(&self) -> ~str {
@ -120,9 +76,6 @@ impl<A:ToStr> ToStr for ~[A] {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use hashmap::HashMap;
use hashmap::HashSet;
use container::{MutableSet, MutableMap};
use super::*; use super::*;
#[test] #[test]
@ -146,42 +99,4 @@ mod tests {
assert!((~[~[], ~[1], ~[1, 1]]).to_str() == assert!((~[~[], ~[1], ~[1, 1]]).to_str() ==
~"[[], [1], [1, 1]]"); ~"[[], [1], [1, 1]]");
} }
struct StructWithToStrWithoutEqOrHash {
value: int
}
impl ToStr for StructWithToStrWithoutEqOrHash {
fn to_str(&self) -> ~str {
format!("s{}", self.value)
}
}
#[test]
fn test_hashmap() {
let mut table: HashMap<int, StructWithToStrWithoutEqOrHash> = HashMap::new();
let empty: HashMap<int, StructWithToStrWithoutEqOrHash> = HashMap::new();
table.insert(3, StructWithToStrWithoutEqOrHash { value: 4 });
table.insert(1, StructWithToStrWithoutEqOrHash { value: 2 });
let table_str = table.to_str();
assert!(table_str == ~"{1: s2, 3: s4}" || table_str == ~"{3: s4, 1: s2}");
assert_eq!(empty.to_str(), ~"{}");
}
#[test]
fn test_hashset() {
let mut set: HashSet<int> = HashSet::new();
let empty_set: HashSet<int> = HashSet::new();
set.insert(1);
set.insert(2);
let set_str = set.to_str();
assert!(set_str == ~"{1, 2}" || set_str == ~"{2, 1}");
assert_eq!(empty_set.to_str(), ~"{}");
}
} }

View file

@ -3395,7 +3395,6 @@ mod tests {
#[test] #[test]
fn test_permutations() { fn test_permutations() {
use hashmap;
{ {
let v: [int, ..0] = []; let v: [int, ..0] = [];
let mut it = v.permutations(); let mut it = v.permutations();
@ -3418,13 +3417,13 @@ mod tests {
assert_eq!(it.next(), None); assert_eq!(it.next(), None);
} }
{ {
// check that we have N! unique permutations // check that we have N! permutations
let mut set = hashmap::HashSet::new();
let v = ['A', 'B', 'C', 'D', 'E', 'F']; let v = ['A', 'B', 'C', 'D', 'E', 'F'];
for perm in v.permutations() { let mut amt = 0;
set.insert(perm); for _perm in v.permutations() {
amt += 1;
} }
assert_eq!(set.len(), 2 * 3 * 4 * 5 * 6); assert_eq!(amt, 2 * 3 * 4 * 5 * 6);
} }
} }

View file

@ -18,7 +18,7 @@ use parse::token::{InternedString, special_idents, str_to_ident};
use parse::token; use parse::token;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
use std::option::Option; use std::option::Option;
use std::rc::Rc; use std::rc::Rc;
use std::to_str::ToStr; use std::to_str::ToStr;
@ -39,7 +39,7 @@ pub fn P<T: 'static>(value: T) -> P<T> {
// table) and a SyntaxContext to track renaming and // table) and a SyntaxContext to track renaming and
// macro expansion per Flatt et al., "Macros // macro expansion per Flatt et al., "Macros
// That Work Together" // That Work Together"
#[deriving(Clone, IterBytes, ToStr, TotalEq, TotalOrd)] #[deriving(Clone, IterBytes, ToStr, TotalEq, TotalOrd, Show)]
pub struct Ident { name: Name, ctxt: SyntaxContext } pub struct Ident { name: Name, ctxt: SyntaxContext }
impl Ident { impl Ident {
@ -177,7 +177,7 @@ pub type CrateNum = u32;
pub type NodeId = u32; pub type NodeId = u32;
#[deriving(Clone, TotalEq, TotalOrd, Eq, Encodable, Decodable, IterBytes, ToStr)] #[deriving(Clone, TotalEq, TotalOrd, Eq, Encodable, Decodable, IterBytes, ToStr, Show)]
pub struct DefId { pub struct DefId {
krate: CrateNum, krate: CrateNum,
node: NodeId, node: NodeId,

View file

@ -20,7 +20,7 @@ use visit;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::cmp; use std::cmp;
use std::hashmap::HashMap; use collections::HashMap;
use std::u32; use std::u32;
use std::local_data; use std::local_data;
@ -964,7 +964,7 @@ mod test {
use ast::*; use ast::*;
use super::*; use super::*;
use opt_vec; use opt_vec;
use std::hashmap::HashMap; use collections::HashMap;
fn ident_to_segment(id : &Ident) -> PathSegment { fn ident_to_segment(id : &Ident) -> PathSegment {
PathSegment {identifier:id.clone(), PathSegment {identifier:id.clone(),

View file

@ -20,7 +20,7 @@ use parse::token::InternedString;
use parse::token; use parse::token;
use crateid::CrateId; use crateid::CrateId;
use std::hashmap::HashSet; use collections::HashSet;
pub trait AttrMetaMethods { pub trait AttrMetaMethods {
// This could be changed to `fn check_name(&self, name: InternedString) -> // This could be changed to `fn check_name(&self, name: InternedString) ->

View file

@ -19,7 +19,7 @@ use parse::token;
use parse::token::{InternedString, intern, str_to_ident}; use parse::token::{InternedString, intern, str_to_ident};
use util::small_vector::SmallVector; use util::small_vector::SmallVector;
use std::hashmap::HashMap; use collections::HashMap;
// new-style macro! tt code: // new-style macro! tt code:
// //

View file

@ -18,7 +18,7 @@ use ext::deriving::generic::*;
use parse::token; use parse::token;
use std::hashmap::HashMap; use collections::HashMap;
pub fn expand_deriving_show(cx: &mut ExtCtxt, pub fn expand_deriving_show(cx: &mut ExtCtxt,
span: Span, span: Span,

View file

@ -18,8 +18,9 @@ use opt_vec;
use parse::token::InternedString; use parse::token::InternedString;
use parse::token; use parse::token;
use rsparse = parse; use rsparse = parse;
use std::fmt::parse; use std::fmt::parse;
use std::hashmap::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use std::vec; use std::vec;
#[deriving(Eq)] #[deriving(Eq)]

View file

@ -21,7 +21,7 @@ use parse::parser::{LifetimeAndTypesWithoutColons, Parser};
use parse::token::{Token, EOF, Nonterminal}; use parse::token::{Token, EOF, Nonterminal};
use parse::token; use parse::token;
use std::hashmap::HashMap; use collections::HashMap;
use std::vec; use std::vec;
/* This is an Earley-like parser, without support for in-grammar nonterminals, /* This is an Earley-like parser, without support for in-grammar nonterminals,

View file

@ -18,7 +18,7 @@ use parse::token;
use parse::lexer::TokenAndSpan; use parse::lexer::TokenAndSpan;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::hashmap::HashMap; use collections::HashMap;
///an unzipping of `TokenTree`s ///an unzipping of `TokenTree`s
struct TtFrame { struct TtFrame {

View file

@ -79,7 +79,7 @@ use opt_vec;
use opt_vec::OptVec; use opt_vec::OptVec;
use std::cell::Cell; use std::cell::Cell;
use std::hashmap::HashSet; use collections::HashSet;
use std::kinds::marker; use std::kinds::marker;
use std::mem::replace; use std::mem::replace;
use std::vec; use std::vec;

View file

@ -14,11 +14,11 @@
use ast::Name; use ast::Name;
use collections::HashMap;
use std::cast; use std::cast;
use std::cell::RefCell; use std::cell::RefCell;
use std::cmp::Equiv; use std::cmp::Equiv;
use std::hash_old::Hash; use std::hash_old::Hash;
use std::hashmap::HashMap;
use std::rc::Rc; use std::rc::Rc;
pub struct Interner<T> { pub struct Interner<T> {

View file

@ -23,6 +23,8 @@
#[deny(non_camel_case_types)]; #[deny(non_camel_case_types)];
#[allow(missing_doc)]; #[allow(missing_doc)];
extern crate collections;
use std::os; use std::os;
use std::io; use std::io;
use terminfo::TermInfo; use terminfo::TermInfo;

View file

@ -10,7 +10,7 @@
#[allow(missing_doc)]; #[allow(missing_doc)];
use std::hashmap::HashMap; use collections::HashMap;
/// A parsed terminfo entry. /// A parsed terminfo entry.
pub struct TermInfo { pub struct TermInfo {

View file

@ -14,8 +14,8 @@
use std::{vec, str}; use std::{vec, str};
use std::hashmap::HashMap;
use std::io; use std::io;
use collections::HashMap;
use super::super::TermInfo; use super::super::TermInfo;
// These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable. // These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable.

View file

@ -519,6 +519,8 @@ impl rand::Rand for Uuid {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
extern crate collections;
use super::{Uuid, VariantMicrosoft, VariantNCS, VariantRFC4122, use super::{Uuid, VariantMicrosoft, VariantNCS, VariantRFC4122,
Version1Mac, Version2Dce, Version3Md5, Version4Random, Version1Mac, Version2Dce, Version3Md5, Version4Random,
Version5Sha1}; Version5Sha1};
@ -800,7 +802,7 @@ mod test {
#[test] #[test]
fn test_iterbytes_impl_for_uuid() { fn test_iterbytes_impl_for_uuid() {
use std::hashmap::HashSet; use self::collections::HashSet;
let mut set = HashSet::new(); let mut set = HashSet::new();
let id1 = Uuid::new_v4(); let id1 = Uuid::new_v4();
let id2 = Uuid::new_v4(); let id2 = Uuid::new_v4();

View file

@ -13,9 +13,10 @@
#[crate_type = "lib"]; #[crate_type = "lib"];
extern crate extra; extern crate extra;
extern crate collections;
use std::cell::RefCell; use std::cell::RefCell;
use std::hashmap::HashMap; use collections::HashMap;
pub type header_map = HashMap<~str, @RefCell<~[@~str]>>; pub type header_map = HashMap<~str, @RefCell<~[@~str]>>;

View file

@ -10,6 +10,8 @@
#[feature(managed_boxes)]; #[feature(managed_boxes)];
use std::hashmap::HashMap; extern crate collections;
use collections::HashMap;
pub type map = @HashMap<uint, uint>; pub type map = @HashMap<uint, uint>;

View file

@ -11,11 +11,9 @@
extern crate collections; extern crate collections;
extern crate time; extern crate time;
use collections::TreeMap; use collections::{TrieMap, TreeMap, HashMap, HashSet};
use std::hashmap::{HashMap, HashSet};
use std::os; use std::os;
use std::rand::{Rng, IsaacRng, SeedableRng}; use std::rand::{Rng, IsaacRng, SeedableRng};
use std::trie::TrieMap;
use std::uint; use std::uint;
use std::vec; use std::vec;

View file

@ -15,7 +15,7 @@ extern crate time;
use collections::bitv::BitvSet; use collections::bitv::BitvSet;
use collections::TreeSet; use collections::TreeSet;
use std::hashmap::HashSet; use collections::HashSet;
use std::os; use std::os;
use std::rand; use std::rand;
use std::uint; use std::uint;
@ -177,7 +177,7 @@ fn main() {
let s: HashSet<~str> = HashSet::new(); let s: HashSet<~str> = HashSet::new();
s s
}); });
write_results("std::hashmap::HashSet", &results); write_results("collections::HashSet", &results);
} }
{ {

View file

@ -14,10 +14,11 @@
// multi tasking k-nucleotide // multi tasking k-nucleotide
extern crate extra; extern crate extra;
extern crate collections;
use std::cmp::Ord; use std::cmp::Ord;
use std::comm; use std::comm;
use std::hashmap::HashMap; use collections::HashMap;
use std::mem::replace; use std::mem::replace;
use std::option; use std::option;
use std::os; use std::os;

View file

@ -10,7 +10,8 @@
//buggy.rs //buggy.rs
use std::hashmap::HashMap; extern crate collections;
use collections::HashMap;
fn main() { fn main() {
let mut buggy_map: HashMap<uint, &uint> = HashMap::new(); let mut buggy_map: HashMap<uint, &uint> = HashMap::new();

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::hashmap::HashSet; extern crate collections;
use collections::HashSet;
struct Foo { struct Foo {
n: HashSet<int>, n: HashSet<int>,

View file

@ -8,8 +8,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::container::Map; extern crate collections;
use std::hashmap::HashMap;
use collections::HashMap;
// Test that trait types printed in error msgs include the type arguments. // Test that trait types printed in error msgs include the type arguments.

View file

@ -13,9 +13,11 @@
#[feature(managed_boxes)]; #[feature(managed_boxes)];
extern crate collections;
fn main() { fn main() {
let _count = @0u; let _count = @0u;
let mut map = std::hashmap::HashMap::new(); let mut map = collections::HashMap::new();
let mut arr = ~[]; let mut arr = ~[];
for _i in range(0u, 10u) { for _i in range(0u, 10u) {
arr.push(@~"key stuff"); arr.push(@~"key stuff");

View file

@ -8,7 +8,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::hashmap::HashMap; extern crate collections;
use collections::HashMap;
// This is a fancy one: it uses an external iterator established // This is a fancy one: it uses an external iterator established
// outside the loop, breaks, then _picks back up_ and continues // outside the loop, breaks, then _picks back up_ and continues

View file

@ -8,7 +8,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::hashmap::HashMap; extern crate collections;
use collections::HashMap;
pub fn main() { pub fn main() {
let mut h = HashMap::new(); let mut h = HashMap::new();

View file

@ -12,6 +12,8 @@
#[feature(managed_boxes)]; #[feature(managed_boxes)];
extern crate collections;
/** /**
A somewhat reduced test case to expose some Valgrind issues. A somewhat reduced test case to expose some Valgrind issues.
@ -21,7 +23,7 @@
pub fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); } pub fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); }
mod map_reduce { mod map_reduce {
use std::hashmap::HashMap; use collections::HashMap;
use std::str; use std::str;
use std::task; use std::task;

View file

@ -10,7 +10,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use std::hashmap::HashMap; extern crate collections;
use collections::HashMap;
pub fn main() { pub fn main() {
let mut m = HashMap::new(); let mut m = HashMap::new();

Some files were not shown because too many files have changed in this diff Show more