From 2a14e084cfd8cf9a9149d0b7c6329b0dad0521d0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Feb 2014 19:29:58 -0800 Subject: 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. --- src/libsyntax/ast.rs | 6 +++--- src/libsyntax/ast_util.rs | 4 ++-- src/libsyntax/attr.rs | 2 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/deriving/show.rs | 2 +- src/libsyntax/ext/format.rs | 3 ++- src/libsyntax/ext/tt/macro_parser.rs | 2 +- src/libsyntax/ext/tt/transcribe.rs | 2 +- src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/util/interner.rs | 2 +- 10 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 9ecc8e50935..db1243b18bc 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -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(value: T) -> P { // 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, diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 790f3927352..8ff66bc6629 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -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(), diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 78e9d3bd46f..93edb552bbe 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -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) -> diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index e6fffe8b53f..0636d19163e 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -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: // diff --git a/src/libsyntax/ext/deriving/show.rs b/src/libsyntax/ext/deriving/show.rs index 56493000a92..5286720b9fc 100644 --- a/src/libsyntax/ext/deriving/show.rs +++ b/src/libsyntax/ext/deriving/show.rs @@ -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, diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 16a12661e9d..1b73d42c79a 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -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)] diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index c2d005da74e..456533de5e9 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -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, diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index fb2aae9b8c1..a8c9fe37226 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -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 { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 30e77c8c1cb..fed2034cd26 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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; diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 1c801f7d970..44b366c9890 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -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 { -- cgit 1.4.1-3-g733a5