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:
parent
edf351e9f7
commit
2a14e084cf
@ -69,7 +69,7 @@ DEPS_flate := std native:miniz
|
||||
DEPS_arena := std collections
|
||||
DEPS_glob := std
|
||||
DEPS_serialize := std
|
||||
DEPS_term := std
|
||||
DEPS_term := std collections
|
||||
DEPS_semver := std
|
||||
DEPS_uuid := std serialize
|
||||
DEPS_sync := std
|
||||
|
@ -467,7 +467,7 @@ expression context, the final namespace qualifier is omitted.
|
||||
Two examples of paths with type arguments:
|
||||
|
||||
~~~~
|
||||
# use std::hashmap::HashMap;
|
||||
# struct HashMap<K, V>;
|
||||
# fn f() {
|
||||
# fn id<T>(t: T) -> T { t }
|
||||
type T = HashMap<int,~str>; // Type arguments used in a type expression
|
||||
|
@ -1977,8 +1977,8 @@ illegal to copy and pass by value.
|
||||
Generic `type`, `struct`, and `enum` declarations follow the same pattern:
|
||||
|
||||
~~~~
|
||||
use std::hashmap::HashMap;
|
||||
type Set<T> = HashMap<T, ()>;
|
||||
extern crate collections;
|
||||
type Set<T> = collections::HashMap<T, ()>;
|
||||
|
||||
struct Stack<T> {
|
||||
elements: ~[T]
|
||||
@ -1988,6 +1988,7 @@ enum Option<T> {
|
||||
Some(T),
|
||||
None
|
||||
}
|
||||
# fn main() {}
|
||||
~~~~
|
||||
|
||||
These declarations can be instantiated to valid types like `Set<int>`,
|
||||
|
@ -55,6 +55,8 @@ c.write(
|
||||
#[crate_id=\"run_pass_stage2#0.1\"];
|
||||
#[feature(globs, macro_rules, struct_variant, managed_boxes)];
|
||||
#[allow(warnings)];
|
||||
extern crate collections;
|
||||
extern crate extra;
|
||||
"""
|
||||
)
|
||||
for t in stage2_tests:
|
||||
|
@ -16,7 +16,7 @@
|
||||
//! # Example
|
||||
//!
|
||||
//! ```rust
|
||||
//! use std::hashmap::HashMap;
|
||||
//! use collections::HashMap;
|
||||
//!
|
||||
//! // type inference lets us omit an explicit type signature (which
|
||||
//! // would be `HashMap<&str, &str>` in this example).
|
||||
@ -52,24 +52,20 @@
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
|
||||
use clone::Clone;
|
||||
use cmp::{Eq, Equiv, max};
|
||||
use default::Default;
|
||||
use fmt;
|
||||
use hash_old::Hash;
|
||||
use iter;
|
||||
use iter::{Iterator, FromIterator, Extendable};
|
||||
use iter::{FilterMap, Chain, Repeat, Zip};
|
||||
use mem::replace;
|
||||
use num;
|
||||
use option::{None, Option, Some};
|
||||
use rand::Rng;
|
||||
use rand;
|
||||
use result::{Ok, Err};
|
||||
use vec::{ImmutableVector, MutableVector, OwnedVector, Items, MutItems};
|
||||
use vec_ng;
|
||||
use vec_ng::Vec;
|
||||
use std::cmp::max;
|
||||
use std::fmt;
|
||||
use std::hash_old::Hash;
|
||||
use std::iter::{FilterMap, Chain, Repeat, Zip};
|
||||
use std::iter;
|
||||
use std::mem::replace;
|
||||
use std::num;
|
||||
use std::rand::Rng;
|
||||
use std::rand;
|
||||
use std::vec::{Items, MutItems};
|
||||
use std::vec_ng::Vec;
|
||||
use std::vec_ng;
|
||||
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
static INITIAL_CAPACITY: uint = 32u; // 2^5
|
||||
|
||||
@ -404,7 +400,7 @@ impl<K: Hash + Eq, V> HashMap<K, V> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use std::hashmap::HashMap;
|
||||
/// use collections::HashMap;
|
||||
///
|
||||
/// // map some strings to vectors of strings
|
||||
/// 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
|
||||
#[deriving(Clone)]
|
||||
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> {
|
||||
fn from_iterator<T: Iterator<K>>(iter: &mut T) -> HashSet<K> {
|
||||
let (lower, _) = iter.size_hint();
|
||||
@ -919,12 +923,75 @@ pub type SetAlgebraItems<'a, T> =
|
||||
FilterMap<'static,(&'a HashSet<T>, &'a T), &'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)]
|
||||
mod test_map {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use fmt;
|
||||
use super::{HashMap, HashSet};
|
||||
use std::fmt;
|
||||
|
||||
#[test]
|
||||
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_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)]
|
||||
mod test_set {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
use container::Container;
|
||||
use vec::ImmutableEqVector;
|
||||
use super::HashSet;
|
||||
|
||||
#[test]
|
||||
fn test_disjoint() {
|
@ -27,21 +27,25 @@ pub use btree::BTree;
|
||||
pub use deque::Deque;
|
||||
pub use dlist::DList;
|
||||
pub use enum_set::EnumSet;
|
||||
pub use hashmap::{HashMap, HashSet};
|
||||
pub use list::List;
|
||||
pub use lru_cache::LruCache;
|
||||
pub use priority_queue::PriorityQueue;
|
||||
pub use ringbuf::RingBuf;
|
||||
pub use smallintmap::SmallIntMap;
|
||||
pub use treemap::{TreeMap, TreeSet};
|
||||
pub use trie::{TrieMap, TrieSet};
|
||||
|
||||
pub mod bitv;
|
||||
pub mod btree;
|
||||
pub mod deque;
|
||||
pub mod dlist;
|
||||
pub mod enum_set;
|
||||
pub mod hashmap;
|
||||
pub mod list;
|
||||
pub mod lru_cache;
|
||||
pub mod priority_queue;
|
||||
pub mod ringbuf;
|
||||
pub mod smallintmap;
|
||||
pub mod treemap;
|
||||
pub mod trie;
|
||||
|
@ -38,11 +38,12 @@
|
||||
//! ```
|
||||
|
||||
use std::container::Container;
|
||||
use std::hashmap::HashMap;
|
||||
use std::to_bytes::Cb;
|
||||
use std::ptr;
|
||||
use std::cast;
|
||||
|
||||
use HashMap;
|
||||
|
||||
struct KeyRef<K> { k: *K }
|
||||
|
||||
struct LruEntry<K, V> {
|
||||
|
@ -10,15 +10,13 @@
|
||||
|
||||
//! Ordered containers with integer keys, implemented as radix tries (`TrieSet` and `TrieMap` types)
|
||||
|
||||
use option::{None, Option, Some};
|
||||
use container::{Container, Map, Mutable, MutableMap};
|
||||
use iter::{Extendable, FromIterator, Iterator};
|
||||
use mem;
|
||||
use uint;
|
||||
use mem::init;
|
||||
use vec;
|
||||
use ptr::RawPtr;
|
||||
use vec::{ImmutableVector, Items, MutableVector, MutItems, OwnedVector};
|
||||
use std::mem;
|
||||
use std::uint;
|
||||
use std::mem::init;
|
||||
use std::vec;
|
||||
use std::vec::{Items, MutItems};
|
||||
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
// FIXME: #5244: need to manually update the TrieNode constructor
|
||||
static SHIFT: uint = 4;
|
||||
@ -622,32 +620,83 @@ impl<'a> Iterator<uint> for SetItems<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub 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 }
|
||||
}
|
||||
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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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)]
|
||||
mod test_map {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
use iter::range_step;
|
||||
use uint;
|
||||
use super::{TrieMap, TrieNode, Internal, External};
|
||||
use std::iter::range_step;
|
||||
use std::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]
|
||||
fn test_find_mut() {
|
||||
@ -903,10 +952,9 @@ mod test_map {
|
||||
#[cfg(test)]
|
||||
mod bench_map {
|
||||
extern crate test;
|
||||
use super::TrieMap;
|
||||
use std::rand::{weak_rng, Rng};
|
||||
use self::test::BenchHarness;
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
use rand::{weak_rng, Rng};
|
||||
|
||||
#[bench]
|
||||
fn bench_iter_small(bh: &mut BenchHarness) {
|
||||
@ -1011,9 +1059,8 @@ mod bench_map {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_set {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
use uint;
|
||||
use super::TrieSet;
|
||||
use std::uint;
|
||||
|
||||
#[test]
|
||||
fn test_sane_chunk() {
|
@ -235,7 +235,7 @@ fn main() {
|
||||
|
||||
use std::char;
|
||||
use std::f64;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::io;
|
||||
use std::io::MemWriter;
|
||||
use std::num;
|
||||
|
@ -12,10 +12,10 @@
|
||||
|
||||
use std::cmp;
|
||||
use std::hash_old::Hash;
|
||||
use std::hashmap;
|
||||
use std::io;
|
||||
use std::mem;
|
||||
use std::num;
|
||||
use collections::hashmap;
|
||||
|
||||
// NB: this can probably be rewritten in terms of num::Num
|
||||
// to be less f64-specific.
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
use std::io::BufReader;
|
||||
use std::cmp::Eq;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::to_bytes;
|
||||
use std::uint;
|
||||
|
||||
@ -957,7 +957,7 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
|
||||
#[test]
|
||||
fn test_url_parse() {
|
||||
|
@ -49,7 +49,6 @@
|
||||
#[allow(non_camel_case_types)];
|
||||
|
||||
use std::comm::Data;
|
||||
use std::hashmap::HashMap;
|
||||
use std::libc;
|
||||
use std::mem;
|
||||
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
|
||||
// hasn't yet been transferred back to the timer itself.
|
||||
let mut active: ~[~Inner] = ~[];
|
||||
let mut dead = HashMap::new();
|
||||
let mut dead = ~[];
|
||||
|
||||
// inserts a timer into an array of timers (sorted by firing time)
|
||||
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.
|
||||
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() {
|
||||
Some(timer) => timer, None => return
|
||||
};
|
||||
@ -127,7 +126,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
|
||||
insert(timer, active);
|
||||
} else {
|
||||
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(RemoveTimer(id, ack)) => {
|
||||
match dead.pop(&id) {
|
||||
Some(i) => { ack.send(i); continue }
|
||||
match dead.iter().position(|&(i, _)| id == i) {
|
||||
Some(i) => {
|
||||
let (_, i) = dead.remove(i).unwrap();
|
||||
ack.send(i);
|
||||
continue
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
let i = active.iter().position(|i| i.id == id);
|
||||
|
@ -35,7 +35,6 @@ use std::libc;
|
||||
use std::ptr;
|
||||
use std::os;
|
||||
use std::rt::rtio;
|
||||
use std::hashmap::HashMap;
|
||||
use std::mem;
|
||||
|
||||
use io::file::FileDesc;
|
||||
@ -78,7 +77,7 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
|
||||
|
||||
add(efd, input);
|
||||
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 {
|
||||
let n = match unsafe {
|
||||
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
|
||||
// times?
|
||||
let _ = FileDesc::new(fd, false).inner_read(bits).unwrap();
|
||||
let remove = {
|
||||
match map.find(&fd).expect("fd unregistered") {
|
||||
&(ref c, oneshot) => !c.try_send(()) || oneshot
|
||||
let (remove, i) = {
|
||||
match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
|
||||
Some(i) => {
|
||||
let (_, ref c, oneshot) = list[i];
|
||||
(!c.try_send(()) || oneshot, i)
|
||||
}
|
||||
None => fail!("fd not active: {}", fd),
|
||||
}
|
||||
};
|
||||
if remove {
|
||||
map.remove(&fd);
|
||||
drop(list.remove(i));
|
||||
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
|
||||
// we need to add it to the epoll set.
|
||||
if map.insert(fd, (chan, one)) {
|
||||
add(efd, fd);
|
||||
match list.bsearch(|&(f, _, _)| f.cmp(&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
|
||||
@ -141,14 +153,18 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
|
||||
}
|
||||
|
||||
Data(RemoveTimer(fd, chan)) => {
|
||||
if map.remove(&fd) {
|
||||
del(efd, fd);
|
||||
match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
|
||||
Some(i) => {
|
||||
drop(list.remove(i));
|
||||
del(efd, fd);
|
||||
}
|
||||
None => {}
|
||||
}
|
||||
chan.send(());
|
||||
}
|
||||
|
||||
Data(Shutdown) => {
|
||||
assert!(map.len() == 0);
|
||||
assert!(list.len() == 0);
|
||||
break 'outer;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ use driver::session;
|
||||
use metadata::cstore;
|
||||
use metadata::filesearch;
|
||||
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::{os, vec};
|
||||
use syntax::abi;
|
||||
|
||||
|
@ -31,12 +31,12 @@ use extra::json;
|
||||
use serialize::Encodable;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::{HashMap,HashSet};
|
||||
use std::io;
|
||||
use std::io::fs;
|
||||
use std::io::MemReader;
|
||||
use std::os;
|
||||
use std::vec;
|
||||
use collections::{HashMap, HashSet};
|
||||
use getopts::{optopt, optmulti, optflag, optflagopt};
|
||||
use getopts;
|
||||
use syntax::ast;
|
||||
|
@ -26,7 +26,7 @@ use syntax::{abi, ast, codemap};
|
||||
use syntax;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::{HashMap,HashSet};
|
||||
use collections::{HashMap,HashSet};
|
||||
|
||||
pub struct Config {
|
||||
os: abi::Os,
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
use std::c_str::ToCStr;
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::libc::{c_uint, c_ushort, c_void, free};
|
||||
use std::str::raw::from_c_str;
|
||||
|
||||
|
@ -21,7 +21,7 @@ use metadata::loader;
|
||||
use metadata::loader::Os;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::abi;
|
||||
use syntax::attr;
|
||||
|
@ -17,7 +17,7 @@ use metadata::decoder;
|
||||
use metadata::loader;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::parse::token::IdentInterner;
|
||||
|
||||
|
@ -27,9 +27,9 @@ use serialize::Encodable;
|
||||
use std::cast;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hash_old::Hash;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::io::MemWriter;
|
||||
use std::str;
|
||||
use collections::{HashMap, HashSet};
|
||||
use syntax::abi::AbiSet;
|
||||
use syntax::ast::*;
|
||||
use syntax::ast;
|
||||
|
@ -14,7 +14,7 @@ use std::cell::RefCell;
|
||||
use std::option;
|
||||
use std::os;
|
||||
use std::io::fs;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
|
||||
pub enum FileMatch { FileMatches, FileDoesntMatch }
|
||||
|
||||
|
@ -26,13 +26,13 @@ use syntax::attr::AttrMetaMethods;
|
||||
|
||||
use std::c_str::ToCStr;
|
||||
use std::cast;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::cmp;
|
||||
use std::io;
|
||||
use std::os::consts::{macos, freebsd, linux, android, win32};
|
||||
use std::str;
|
||||
use std::vec;
|
||||
|
||||
use collections::{HashMap, HashSet};
|
||||
use flate;
|
||||
use time;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#[allow(non_camel_case_types)];
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::io;
|
||||
use std::io::MemWriter;
|
||||
use std::str;
|
||||
|
@ -21,7 +21,7 @@ use middle::dataflow::DataFlowOperator;
|
||||
use util::ppaux::{note_and_explain_region, Repr, UserString};
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::ops::{BitOr, BitAnd};
|
||||
use std::result::{Result};
|
||||
use syntax::ast;
|
||||
|
@ -16,8 +16,8 @@ comments in the section "Moves and initialization" and in `doc.rs`.
|
||||
*/
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::uint;
|
||||
use collections::{HashMap, HashSet};
|
||||
use middle::borrowck::*;
|
||||
use middle::dataflow::DataFlowContext;
|
||||
use middle::dataflow::DataFlowOperator;
|
||||
|
@ -12,7 +12,7 @@ use middle::cfg::*;
|
||||
use middle::graph;
|
||||
use middle::typeck;
|
||||
use middle::ty;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
use syntax::opt_vec;
|
||||
|
@ -18,7 +18,7 @@ Uses `Graph` as the underlying representation.
|
||||
use middle::graph;
|
||||
use middle::ty;
|
||||
use middle::typeck;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::opt_vec::OptVec;
|
||||
|
||||
|
@ -24,7 +24,7 @@ use syntax::visit;
|
||||
use syntax::{ast, ast_map, ast_util};
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
|
||||
//
|
||||
|
@ -20,7 +20,7 @@
|
||||
use std::io;
|
||||
use std::uint;
|
||||
use std::vec;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
use syntax::ast_util::IdRange;
|
||||
|
@ -17,7 +17,7 @@ use middle::privacy;
|
||||
use middle::ty;
|
||||
use middle::typeck;
|
||||
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use syntax::ast;
|
||||
use syntax::ast_map;
|
||||
use syntax::ast_util::{local_def, def_id_of_def, is_local};
|
||||
|
@ -16,7 +16,7 @@
|
||||
use middle::resolve;
|
||||
use middle::ty;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::{ast, ast_util};
|
||||
use syntax::visit;
|
||||
|
@ -30,7 +30,7 @@ use syntax::parse::token::InternedString;
|
||||
use syntax::visit::Visitor;
|
||||
use syntax::visit;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::iter::Enumerate;
|
||||
use std::vec;
|
||||
|
||||
|
@ -49,7 +49,7 @@ use std::to_str::ToStr;
|
||||
use util::ppaux::{ty_to_str};
|
||||
|
||||
use std::cmp;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::i16;
|
||||
use std::i32;
|
||||
use std::i64;
|
||||
|
@ -111,7 +111,7 @@ use middle::moves;
|
||||
|
||||
use std::cast::transmute;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::io;
|
||||
use std::str;
|
||||
use std::to_str;
|
||||
|
@ -137,8 +137,8 @@ use util::common::indenter;
|
||||
use util::ppaux::UserString;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::{HashSet, HashMap};
|
||||
use std::rc::Rc;
|
||||
use collections::{HashSet, HashMap};
|
||||
use syntax::ast::*;
|
||||
use syntax::ast_util;
|
||||
use syntax::visit;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
use middle::resolve;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast::*;
|
||||
use syntax::ast_util::{path_to_ident, walk_pat};
|
||||
use syntax::codemap::Span;
|
||||
|
@ -12,8 +12,8 @@
|
||||
//! outside their scopes. This pass will also generate a set of exported items
|
||||
//! which are available for use externally when compiled as a library.
|
||||
|
||||
use std::hashmap::{HashSet, HashMap};
|
||||
use std::mem::replace;
|
||||
use collections::{HashSet, HashMap};
|
||||
|
||||
use metadata::csearch;
|
||||
use middle::resolve;
|
||||
|
@ -20,7 +20,7 @@ use middle::typeck;
|
||||
use middle::privacy;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use syntax::ast;
|
||||
use syntax::ast_map;
|
||||
use syntax::ast_util::{def_id_of_def, is_local};
|
||||
|
@ -26,7 +26,7 @@ use middle::ty::{FreeRegion};
|
||||
use middle::ty;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use collections::{HashMap, HashSet};
|
||||
use syntax::codemap::Span;
|
||||
use syntax::{ast, visit};
|
||||
use syntax::visit::{Visitor, FnKind};
|
||||
|
@ -31,8 +31,8 @@ use syntax::visit::Visitor;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::uint;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::mem::replace;
|
||||
use collections::{HashMap, HashSet};
|
||||
|
||||
// Definition mapping
|
||||
pub type DefMap = @RefCell<HashMap<NodeId,Def>>;
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
use driver::session;
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use syntax::opt_vec::OptVec;
|
||||
|
@ -223,7 +223,7 @@ use util::common::indenter;
|
||||
use util::ppaux::{Repr, vec_map_to_str};
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::vec;
|
||||
use syntax::ast;
|
||||
use syntax::ast::Ident;
|
||||
|
@ -74,7 +74,7 @@ use util::sha2::Sha256;
|
||||
use arena::TypedArena;
|
||||
use std::c_str::ToCStr;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::libc::c_uint;
|
||||
use std::local_data;
|
||||
use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic, OsWin32};
|
||||
|
@ -17,8 +17,8 @@ use middle::trans::base;
|
||||
use middle::trans::common::*;
|
||||
use middle::trans::machine::llalign_of_pref;
|
||||
use middle::trans::type_::Type;
|
||||
use std::hashmap::HashMap;
|
||||
use std::libc::{c_uint, c_ulonglong, c_char};
|
||||
use collections::HashMap;
|
||||
use syntax::codemap::Span;
|
||||
|
||||
pub struct Builder<'a> {
|
||||
|
@ -33,7 +33,7 @@ use util::ppaux::Repr;
|
||||
use arena::TypedArena;
|
||||
use std::c_str::ToCStr;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::libc::{c_uint, c_longlong, c_ulonglong, c_char};
|
||||
use syntax::ast::Ident;
|
||||
use syntax::ast;
|
||||
|
@ -29,9 +29,9 @@ use util::sha2::Sha256;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::c_str::ToCStr;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::local_data;
|
||||
use std::libc::c_uint;
|
||||
use collections::{HashMap, HashSet};
|
||||
use syntax::ast;
|
||||
use syntax::parse::token::InternedString;
|
||||
|
||||
|
@ -142,8 +142,8 @@ use util::ppaux;
|
||||
|
||||
use std::c_str::{CString, ToCStr};
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashMap;
|
||||
use collections::HashSet;
|
||||
use std::libc::{c_uint, c_ulonglong, c_longlong};
|
||||
use std::ptr;
|
||||
use std::sync::atomics;
|
||||
|
@ -70,7 +70,7 @@ use middle::trans::machine::llsize_of;
|
||||
|
||||
use middle::trans::type_::Type;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::vec;
|
||||
use syntax::ast;
|
||||
use syntax::ast_map;
|
||||
|
@ -33,12 +33,12 @@ use util::common::{indenter};
|
||||
use std::cast;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cmp;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::ops;
|
||||
use std::rc::Rc;
|
||||
use std::to_bytes;
|
||||
use std::to_str::ToStr;
|
||||
use std::vec;
|
||||
use collections::{HashMap, HashSet};
|
||||
use syntax::ast::*;
|
||||
use syntax::ast_util::{is_local, lit_is_str};
|
||||
use syntax::ast_util;
|
||||
@ -460,7 +460,7 @@ pub struct param_ty {
|
||||
}
|
||||
|
||||
/// Representation of regions:
|
||||
#[deriving(Clone, Eq, IterBytes, Encodable, Decodable, ToStr)]
|
||||
#[deriving(Clone, Eq, IterBytes, Encodable, Decodable, ToStr, Show)]
|
||||
pub enum Region {
|
||||
// Region bound in a type or fn declaration which will be
|
||||
// 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 {
|
||||
scope_id: NodeId,
|
||||
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 {
|
||||
/// An anonymous region parameter for a given fn (&T)
|
||||
BrAnon(uint),
|
||||
@ -869,7 +869,7 @@ pub struct IntVid(uint);
|
||||
#[deriving(Clone, Eq, IterBytes)]
|
||||
pub struct FloatVid(uint);
|
||||
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes, Show)]
|
||||
pub struct RegionVid {
|
||||
id: uint
|
||||
}
|
||||
@ -881,7 +881,7 @@ pub enum InferTy {
|
||||
FloatVar(FloatVid)
|
||||
}
|
||||
|
||||
#[deriving(Clone, Encodable, Decodable, IterBytes, ToStr)]
|
||||
#[deriving(Clone, Encodable, Decodable, IterBytes, ToStr, Show)]
|
||||
pub enum InferRegion {
|
||||
ReVar(RegionVid),
|
||||
ReSkolemized(uint, BoundRegion)
|
||||
|
@ -19,7 +19,7 @@ use middle::typeck::check::{structure_of, valid_range_bounds};
|
||||
use middle::typeck::infer;
|
||||
use middle::typeck::require_same_types;
|
||||
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use collections::{HashMap, HashSet};
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
use syntax::parse::token;
|
||||
|
@ -98,7 +98,7 @@ use util::common::indenter;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::result;
|
||||
use std::vec;
|
||||
use syntax::ast::{DefId, SelfValue, SelfRegion};
|
||||
|
@ -114,7 +114,7 @@ use util::ppaux;
|
||||
use util::ppaux::{UserString, Repr};
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::mem::replace;
|
||||
use std::result;
|
||||
use std::vec;
|
||||
|
@ -13,7 +13,7 @@
|
||||
use middle::ty;
|
||||
use middle::ty_fold;
|
||||
use middle::ty_fold::TypeFolder;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use util::ppaux::Repr;
|
||||
use util::ppaux;
|
||||
|
||||
@ -39,7 +39,7 @@ pub fn replace_bound_regions_in_fn_sig(
|
||||
});
|
||||
ty_fold::super_fold_sig(&mut f, fn_sig)
|
||||
};
|
||||
debug!("resulting map: {}", map.to_str());
|
||||
debug!("resulting map: {}", map);
|
||||
(map, fn_sig)
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ use util::ppaux;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::result;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
|
@ -47,7 +47,7 @@ use syntax::parse::token;
|
||||
use syntax::visit;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::rc::Rc;
|
||||
use std::vec;
|
||||
|
||||
|
@ -24,7 +24,7 @@ use middle::typeck::infer::fold_regions_in_sig;
|
||||
use syntax::ast::{Many, Once, MutImmutable, MutMutable};
|
||||
use syntax::ast::{ExternFn, ImpureFn, UnsafeFn, NodeId};
|
||||
use syntax::ast::{Onceness, Purity};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use util::common::{indenter};
|
||||
use util::ppaux::mt_to_str;
|
||||
|
||||
|
@ -43,7 +43,7 @@ use middle::typeck::infer::lub::Lub;
|
||||
use middle::typeck::infer::unify::*;
|
||||
use middle::typeck::infer::sub::Sub;
|
||||
use middle::typeck::infer::to_str::InferStr;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use util::common::indenter;
|
||||
|
||||
pub trait LatticeValue {
|
||||
|
@ -21,7 +21,7 @@ use middle::typeck::infer::to_str::InferStr;
|
||||
use middle::typeck::infer::{cres, InferCtxt};
|
||||
use middle::typeck::infer::fold_regions_in_sig;
|
||||
use middle::typeck::infer::{TypeTrace, Subtype};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use syntax::ast::{Many, Once, NodeId};
|
||||
use syntax::ast::{ExternFn, ImpureFn, UnsafeFn};
|
||||
use syntax::ast::{Onceness, Purity};
|
||||
|
@ -37,7 +37,7 @@ use middle::typeck::infer::to_str::InferStr;
|
||||
use middle::typeck::infer::unify::{ValsAndBindings, Root};
|
||||
use middle::typeck::infer::error_reporting::ErrorReporting;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::result;
|
||||
use std::vec;
|
||||
use syntax::ast::{MutImmutable, MutMutable};
|
||||
|
@ -25,9 +25,9 @@ use util::common::indenter;
|
||||
use util::ppaux::{Repr};
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::uint;
|
||||
use std::vec;
|
||||
use collections::{HashMap, HashSet};
|
||||
use syntax::ast;
|
||||
use syntax::opt_vec;
|
||||
use syntax::opt_vec::OptVec;
|
||||
|
@ -70,7 +70,7 @@ use util::ppaux::Repr;
|
||||
use util::ppaux;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
use collections::List;
|
||||
use collections::list;
|
||||
|
@ -192,7 +192,7 @@ represents the "variance transform" as defined in the paper:
|
||||
|
||||
*/
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use arena;
|
||||
use arena::Arena;
|
||||
use middle::ty;
|
||||
|
@ -21,7 +21,7 @@ use syntax;
|
||||
use std::cell::RefCell;
|
||||
use std::os;
|
||||
use std::local_data;
|
||||
use std::hashmap::{HashSet};
|
||||
use collections::HashSet;
|
||||
|
||||
use visit_ast::RustdocVisitor;
|
||||
use clean;
|
||||
|
@ -34,12 +34,12 @@
|
||||
//! both occur before the crate is rendered.
|
||||
|
||||
use std::fmt;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::local_data;
|
||||
use std::io;
|
||||
use std::io::{fs, File, BufferedWriter};
|
||||
use std::str;
|
||||
use std::vec;
|
||||
use collections::{HashMap, HashSet};
|
||||
|
||||
use sync::Arc;
|
||||
use extra::json::ToJson;
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
use std::cmp;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::local_data;
|
||||
use std::uint;
|
||||
use syntax::ast;
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::local_data;
|
||||
use std::os;
|
||||
use std::run;
|
||||
|
@ -14,10 +14,7 @@
|
||||
Core encoding and decoding interfaces.
|
||||
*/
|
||||
|
||||
use std::hash_old::Hash;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use std::rc::Rc;
|
||||
use std::trie::{TrieMap, TrieSet};
|
||||
use std::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
|
||||
//
|
||||
|
@ -20,12 +20,14 @@ definitions for a number of signals.
|
||||
*/
|
||||
|
||||
use clone::Clone;
|
||||
use result::{Ok, Err};
|
||||
use comm::{Port, Chan};
|
||||
use container::{Map, MutableMap};
|
||||
use hashmap;
|
||||
use io;
|
||||
use iter::Iterator;
|
||||
use mem::drop;
|
||||
use option::{Some, None};
|
||||
use result::{Ok, Err};
|
||||
use rt::rtio::{IoFactory, LocalIo, RtioSignal};
|
||||
use vec::{ImmutableVector, OwnedVector};
|
||||
|
||||
#[repr(int)]
|
||||
#[deriving(Eq, IterBytes)]
|
||||
@ -78,7 +80,7 @@ pub enum Signum {
|
||||
/// ```
|
||||
pub struct Listener {
|
||||
/// 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
|
||||
/// the clients from port.
|
||||
priv chan: Chan<Signum>,
|
||||
@ -97,7 +99,7 @@ impl Listener {
|
||||
Listener {
|
||||
chan: chan,
|
||||
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
|
||||
/// be returned.
|
||||
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
|
||||
}
|
||||
match LocalIo::maybe_raise(|io| {
|
||||
io.signal(signum, self.chan.clone())
|
||||
}) {
|
||||
Ok(handle) => {
|
||||
self.handles.insert(signum, handle);
|
||||
self.handles.push((signum, handle));
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e)
|
||||
@ -137,7 +139,10 @@ impl Listener {
|
||||
/// notification about the signal. If the signal has already been received,
|
||||
/// it may still be returned by `recv`.
|
||||
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 => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
//! # The Rust standard library
|
||||
//!
|
||||
//! 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
|
||||
//! features and other common functionality.
|
||||
//!
|
||||
@ -68,9 +68,9 @@
|
||||
// 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
|
||||
// of
|
||||
#[cfg(test)] extern crate rustuv = "rustuv";
|
||||
#[cfg(test)] extern crate native = "native";
|
||||
#[cfg(test)] extern crate green = "green";
|
||||
#[cfg(test)] extern crate rustuv;
|
||||
#[cfg(test)] extern crate native;
|
||||
#[cfg(test)] extern crate green;
|
||||
|
||||
// Make extra accessible for benchmarking
|
||||
#[cfg(test)] extern crate extra = "extra";
|
||||
@ -156,9 +156,7 @@ pub mod any;
|
||||
|
||||
pub mod option;
|
||||
pub mod result;
|
||||
pub mod hashmap;
|
||||
pub mod cell;
|
||||
pub mod trie;
|
||||
|
||||
|
||||
/* Tasks and communication */
|
||||
|
@ -70,7 +70,7 @@ hello // turns on all logging for the 'hello' module
|
||||
info // turns on all info logging
|
||||
hello=debug // turns on debug 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
|
||||
```
|
||||
|
||||
|
@ -8,13 +8,13 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use cmp::TotalOrd;
|
||||
use container::MutableSet;
|
||||
use hashmap::HashSet;
|
||||
use iter::Iterator;
|
||||
use option::{Some, None, Option};
|
||||
use ptr::RawPtr;
|
||||
use vec::ImmutableVector;
|
||||
use rt::rtio::EventLoop;
|
||||
use vec::{ImmutableVector, OwnedVector};
|
||||
|
||||
// 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
|
||||
@ -89,28 +89,33 @@ fn version(crate_map: &CrateMap) -> i32 {
|
||||
fn do_iter_crate_map<'a>(
|
||||
crate_map: &'a CrateMap<'a>,
|
||||
f: |&ModEntry|,
|
||||
visited: &mut HashSet<*CrateMap<'a>>) {
|
||||
if visited.insert(crate_map as *CrateMap) {
|
||||
match version(crate_map) {
|
||||
2 => {
|
||||
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")
|
||||
}
|
||||
visited: &mut ~[*CrateMap<'a>]) {
|
||||
let raw = crate_map as *CrateMap<'a>;
|
||||
if visited.bsearch(|a| (*a as uint).cmp(&(raw as uint))).is_some() {
|
||||
return
|
||||
}
|
||||
match visited.iter().position(|i| *i as uint > raw as uint) {
|
||||
Some(i) => visited.insert(i, raw),
|
||||
None => visited.push(raw),
|
||||
}
|
||||
|
||||
match version(crate_map) {
|
||||
2 => {
|
||||
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
|
||||
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
|
||||
// way to do this
|
||||
let mut v: HashSet<*CrateMap<'a>> = HashSet::with_capacity_and_keys(0, 0, 32);
|
||||
let mut v = ~[];
|
||||
do_iter_crate_map(crate_map, f, &mut v);
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,7 @@ The `ToStr` trait for converting to strings
|
||||
|
||||
use option::{Some, None};
|
||||
use str::OwnedStr;
|
||||
use hashmap::HashMap;
|
||||
use hashmap::HashSet;
|
||||
use hash_old::Hash;
|
||||
use iter::Iterator;
|
||||
use cmp::Eq;
|
||||
use vec::ImmutableVector;
|
||||
|
||||
/// A generic trait for converting a value to a string
|
||||
@ -40,46 +36,6 @@ impl ToStr for () {
|
||||
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] {
|
||||
#[inline]
|
||||
fn to_str(&self) -> ~str {
|
||||
@ -120,9 +76,6 @@ impl<A:ToStr> ToStr for ~[A] {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use hashmap::HashMap;
|
||||
use hashmap::HashSet;
|
||||
use container::{MutableSet, MutableMap};
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
@ -146,42 +99,4 @@ mod tests {
|
||||
assert!((~[~[], ~[1], ~[1, 1]]).to_str() ==
|
||||
~"[[], [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(), ~"{}");
|
||||
}
|
||||
}
|
||||
|
@ -3395,7 +3395,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_permutations() {
|
||||
use hashmap;
|
||||
{
|
||||
let v: [int, ..0] = [];
|
||||
let mut it = v.permutations();
|
||||
@ -3418,13 +3417,13 @@ mod tests {
|
||||
assert_eq!(it.next(), None);
|
||||
}
|
||||
{
|
||||
// check that we have N! unique permutations
|
||||
let mut set = hashmap::HashSet::new();
|
||||
// check that we have N! permutations
|
||||
let v = ['A', 'B', 'C', 'D', 'E', 'F'];
|
||||
for perm in v.permutations() {
|
||||
set.insert(perm);
|
||||
let mut amt = 0;
|
||||
for _perm in v.permutations() {
|
||||
amt += 1;
|
||||
}
|
||||
assert_eq!(set.len(), 2 * 3 * 4 * 5 * 6);
|
||||
assert_eq!(amt, 2 * 3 * 4 * 5 * 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ use parse::token::{InternedString, special_idents, str_to_ident};
|
||||
use parse::token;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::option::Option;
|
||||
use std::rc::Rc;
|
||||
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
|
||||
// macro expansion per Flatt et al., "Macros
|
||||
// That Work Together"
|
||||
#[deriving(Clone, IterBytes, ToStr, TotalEq, TotalOrd)]
|
||||
#[deriving(Clone, IterBytes, ToStr, TotalEq, TotalOrd, Show)]
|
||||
pub struct Ident { name: Name, ctxt: SyntaxContext }
|
||||
|
||||
impl Ident {
|
||||
@ -177,7 +177,7 @@ pub type CrateNum = 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 {
|
||||
krate: CrateNum,
|
||||
node: NodeId,
|
||||
|
@ -20,7 +20,7 @@ use visit;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cmp;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::u32;
|
||||
use std::local_data;
|
||||
|
||||
@ -964,7 +964,7 @@ mod test {
|
||||
use ast::*;
|
||||
use super::*;
|
||||
use opt_vec;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
|
||||
fn ident_to_segment(id : &Ident) -> PathSegment {
|
||||
PathSegment {identifier:id.clone(),
|
||||
|
@ -20,7 +20,7 @@ use parse::token::InternedString;
|
||||
use parse::token;
|
||||
use crateid::CrateId;
|
||||
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
|
||||
pub trait AttrMetaMethods {
|
||||
// This could be changed to `fn check_name(&self, name: InternedString) ->
|
||||
|
@ -19,7 +19,7 @@ use parse::token;
|
||||
use parse::token::{InternedString, intern, str_to_ident};
|
||||
use util::small_vector::SmallVector;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
|
||||
// new-style macro! tt code:
|
||||
//
|
||||
|
@ -18,7 +18,7 @@ use ext::deriving::generic::*;
|
||||
|
||||
use parse::token;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
|
||||
pub fn expand_deriving_show(cx: &mut ExtCtxt,
|
||||
span: Span,
|
||||
|
@ -18,8 +18,9 @@ use opt_vec;
|
||||
use parse::token::InternedString;
|
||||
use parse::token;
|
||||
use rsparse = parse;
|
||||
|
||||
use std::fmt::parse;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use collections::{HashMap, HashSet};
|
||||
use std::vec;
|
||||
|
||||
#[deriving(Eq)]
|
||||
|
@ -21,7 +21,7 @@ use parse::parser::{LifetimeAndTypesWithoutColons, Parser};
|
||||
use parse::token::{Token, EOF, Nonterminal};
|
||||
use parse::token;
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::vec;
|
||||
|
||||
/* This is an Earley-like parser, without support for in-grammar nonterminals,
|
||||
|
@ -18,7 +18,7 @@ use parse::token;
|
||||
use parse::lexer::TokenAndSpan;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
|
||||
///an unzipping of `TokenTree`s
|
||||
struct TtFrame {
|
||||
|
@ -79,7 +79,7 @@ use opt_vec;
|
||||
use opt_vec::OptVec;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::kinds::marker;
|
||||
use std::mem::replace;
|
||||
use std::vec;
|
||||
|
@ -14,11 +14,11 @@
|
||||
|
||||
use ast::Name;
|
||||
|
||||
use collections::HashMap;
|
||||
use std::cast;
|
||||
use std::cell::RefCell;
|
||||
use std::cmp::Equiv;
|
||||
use std::hash_old::Hash;
|
||||
use std::hashmap::HashMap;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Interner<T> {
|
||||
|
@ -23,6 +23,8 @@
|
||||
#[deny(non_camel_case_types)];
|
||||
#[allow(missing_doc)];
|
||||
|
||||
extern crate collections;
|
||||
|
||||
use std::os;
|
||||
use std::io;
|
||||
use terminfo::TermInfo;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#[allow(missing_doc)];
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
|
||||
/// A parsed terminfo entry.
|
||||
pub struct TermInfo {
|
||||
|
@ -14,8 +14,8 @@
|
||||
|
||||
|
||||
use std::{vec, str};
|
||||
use std::hashmap::HashMap;
|
||||
use std::io;
|
||||
use collections::HashMap;
|
||||
use super::super::TermInfo;
|
||||
|
||||
// These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable.
|
||||
|
@ -519,6 +519,8 @@ impl rand::Rand for Uuid {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
extern crate collections;
|
||||
|
||||
use super::{Uuid, VariantMicrosoft, VariantNCS, VariantRFC4122,
|
||||
Version1Mac, Version2Dce, Version3Md5, Version4Random,
|
||||
Version5Sha1};
|
||||
@ -800,7 +802,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn test_iterbytes_impl_for_uuid() {
|
||||
use std::hashmap::HashSet;
|
||||
use self::collections::HashSet;
|
||||
let mut set = HashSet::new();
|
||||
let id1 = Uuid::new_v4();
|
||||
let id2 = Uuid::new_v4();
|
||||
|
@ -13,9 +13,10 @@
|
||||
#[crate_type = "lib"];
|
||||
|
||||
extern crate extra;
|
||||
extern crate collections;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
|
||||
pub type header_map = HashMap<~str, @RefCell<~[@~str]>>;
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
extern crate collections;
|
||||
|
||||
use collections::HashMap;
|
||||
|
||||
pub type map = @HashMap<uint, uint>;
|
||||
|
@ -11,11 +11,9 @@
|
||||
extern crate collections;
|
||||
extern crate time;
|
||||
|
||||
use collections::TreeMap;
|
||||
use std::hashmap::{HashMap, HashSet};
|
||||
use collections::{TrieMap, TreeMap, HashMap, HashSet};
|
||||
use std::os;
|
||||
use std::rand::{Rng, IsaacRng, SeedableRng};
|
||||
use std::trie::TrieMap;
|
||||
use std::uint;
|
||||
use std::vec;
|
||||
|
||||
|
@ -15,7 +15,7 @@ extern crate time;
|
||||
|
||||
use collections::bitv::BitvSet;
|
||||
use collections::TreeSet;
|
||||
use std::hashmap::HashSet;
|
||||
use collections::HashSet;
|
||||
use std::os;
|
||||
use std::rand;
|
||||
use std::uint;
|
||||
@ -177,7 +177,7 @@ fn main() {
|
||||
let s: HashSet<~str> = HashSet::new();
|
||||
s
|
||||
});
|
||||
write_results("std::hashmap::HashSet", &results);
|
||||
write_results("collections::HashSet", &results);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -14,10 +14,11 @@
|
||||
// multi tasking k-nucleotide
|
||||
|
||||
extern crate extra;
|
||||
extern crate collections;
|
||||
|
||||
use std::cmp::Ord;
|
||||
use std::comm;
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::mem::replace;
|
||||
use std::option;
|
||||
use std::os;
|
||||
|
@ -10,7 +10,8 @@
|
||||
|
||||
//buggy.rs
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
extern crate collections;
|
||||
use collections::HashMap;
|
||||
|
||||
fn main() {
|
||||
let mut buggy_map: HashMap<uint, &uint> = HashMap::new();
|
||||
|
@ -8,7 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::hashmap::HashSet;
|
||||
extern crate collections;
|
||||
use collections::HashSet;
|
||||
|
||||
struct Foo {
|
||||
n: HashSet<int>,
|
||||
|
@ -8,8 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::container::Map;
|
||||
use std::hashmap::HashMap;
|
||||
extern crate collections;
|
||||
|
||||
use collections::HashMap;
|
||||
|
||||
// Test that trait types printed in error msgs include the type arguments.
|
||||
|
||||
|
@ -13,9 +13,11 @@
|
||||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
extern crate collections;
|
||||
|
||||
fn main() {
|
||||
let _count = @0u;
|
||||
let mut map = std::hashmap::HashMap::new();
|
||||
let mut map = collections::HashMap::new();
|
||||
let mut arr = ~[];
|
||||
for _i in range(0u, 10u) {
|
||||
arr.push(@~"key stuff");
|
||||
|
@ -8,7 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// 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
|
||||
// outside the loop, breaks, then _picks back up_ and continues
|
||||
|
@ -8,7 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
extern crate collections;
|
||||
|
||||
use collections::HashMap;
|
||||
|
||||
pub fn main() {
|
||||
let mut h = HashMap::new();
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
extern crate collections;
|
||||
|
||||
/**
|
||||
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"); }
|
||||
|
||||
mod map_reduce {
|
||||
use std::hashmap::HashMap;
|
||||
use collections::HashMap;
|
||||
use std::str;
|
||||
use std::task;
|
||||
|
||||
|
@ -10,7 +10,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::hashmap::HashMap;
|
||||
extern crate collections;
|
||||
|
||||
use collections::HashMap;
|
||||
|
||||
pub fn main() {
|
||||
let mut m = HashMap::new();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user