From 70855f5a07bb17e6690c32832dec452cb211b18a Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Thu, 31 Jan 2013 18:18:07 -0500 Subject: [PATCH] move smallintmap to oldsmallintmap --- src/librustc/middle/lint.rs | 11 ++++++----- src/librustc/middle/trans/base.rs | 2 +- src/librustc/middle/ty.rs | 10 +++++----- src/librustc/middle/typeck/infer/mod.rs | 4 ++-- src/librustc/middle/typeck/infer/unify.rs | 2 +- src/librustc/middle/typeck/mod.rs | 4 ++-- src/libstd/{smallintmap.rs => oldsmallintmap.rs} | 2 +- src/libstd/std.rc | 2 +- src/test/bench/std-smallintmap.rs | 8 ++++---- 9 files changed, 23 insertions(+), 22 deletions(-) rename src/libstd/{smallintmap.rs => oldsmallintmap.rs} (99%) diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 9017b1e1537..daa335fed93 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -34,8 +34,8 @@ use core::uint; use core::vec; use std::map::{Map, HashMap}; use std::map; -use std::smallintmap::{Map, SmallIntMap}; -use std::smallintmap; +use std::oldsmallintmap::{Map, SmallIntMap}; +use std::oldsmallintmap; use syntax::ast_util::{path_to_ident}; use syntax::attr; use syntax::codemap::span; @@ -248,7 +248,7 @@ pub type lint_settings = { }; pub fn mk_lint_settings() -> lint_settings { - {default_settings: smallintmap::mk(), + {default_settings: oldsmallintmap::mk(), settings_map: HashMap()} } @@ -273,7 +273,8 @@ pub fn get_lint_settings_level(settings: lint_settings, // This is kind of unfortunate. It should be somewhere else, or we should use // a persistent data structure... fn clone_lint_modes(modes: lint_modes) -> lint_modes { - smallintmap::SmallIntMap_(@smallintmap::SmallIntMap_ { v: copy modes.v }) + oldsmallintmap::SmallIntMap_(@oldsmallintmap::SmallIntMap_ + {v: copy modes.v}) } type ctxt_ = {dict: lint_dict, @@ -393,7 +394,7 @@ fn build_settings_item(i: @ast::item, &&cx: ctxt, v: visit::vt) { pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) { let cx = ctxt_({dict: get_lint_dict(), - curr: smallintmap::mk(), + curr: oldsmallintmap::mk(), is_default: true, sess: sess}); diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index dd4c773278f..d0f9c931616 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -76,7 +76,7 @@ use core::option::{is_none, is_some}; use core::option; use core::uint; use std::map::HashMap; -use std::smallintmap; +use std::oldsmallintmap; use std::{map, time, list}; use syntax::ast_map::{path, path_elt_to_str, path_mod, path_name}; use syntax::ast_util::{def_id_of_def, local_def, path_to_ident}; diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 928a1cfa967..b07e3ef7b81 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -42,7 +42,7 @@ use core::to_bytes; use core::uint; use core::vec; use std::map::HashMap; -use std::{map, smallintmap}; +use std::{map, oldsmallintmap}; use syntax::ast::*; use syntax::ast_util::{is_local, local_def}; use syntax::ast_util; @@ -785,7 +785,7 @@ type type_cache = HashMap; type constness_cache = HashMap; -pub type node_type_table = @smallintmap::SmallIntMap; +pub type node_type_table = @oldsmallintmap::SmallIntMap; fn mk_rcache() -> creader_cache { type val = {cnum: int, pos: uint, len: uint}; @@ -837,7 +837,7 @@ pub fn mk_ctxt(s: session::Session, def_map: dm, region_map: region_map, region_paramd_items: region_paramd_items, - node_types: @smallintmap::mk(), + node_types: @oldsmallintmap::mk(), node_type_substs: map::HashMap(), items: amap, intrinsic_defs: map::HashMap(), @@ -2799,7 +2799,7 @@ pub fn br_hashmap() -> HashMap { pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t { //io::println(fmt!("%?/%?", id, cx.node_types.size())); - match smallintmap::find(*cx.node_types, id as uint) { + match oldsmallintmap::find(*cx.node_types, id as uint) { Some(t) => t, None => cx.sess.bug( fmt!("node_id_to_type: no type for node `%s`", @@ -3175,7 +3175,7 @@ pub fn expr_kind(tcx: ctxt, } ast::expr_cast(*) => { - match smallintmap::find(*tcx.node_types, expr.id as uint) { + match oldsmallintmap::find(*tcx.node_types, expr.id as uint) { Some(t) => { if ty::type_is_immediate(t) { RvalueDatumExpr diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 2272e99995d..2a39022e8d4 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -281,7 +281,7 @@ use core::result; use core::vec; use std::list::Nil; use std::map::HashMap; -use std::smallintmap; +use std::oldsmallintmap; use syntax::ast::{ret_style, purity}; use syntax::ast::{m_const, m_imm, m_mutbl}; use syntax::ast::{unsafe_fn, impure_fn, pure_fn, extern_fn}; @@ -353,7 +353,7 @@ pub fn fixup_err_to_str(f: fixup_err) -> ~str { fn new_ValsAndBindings() -> ValsAndBindings { ValsAndBindings { - vals: smallintmap::mk(), + vals: oldsmallintmap::mk(), mut bindings: ~[] } } diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index 30329f29945..3b38197c51c 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -10,7 +10,7 @@ use core::prelude::*; use core::result; -use std::smallintmap::SmallIntMap; +use std::oldsmallintmap::SmallIntMap; use middle::ty::{Vid, expected_found, IntVarValue}; use middle::ty; diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index ae57cd90bd7..5059de13149 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -69,7 +69,7 @@ use std::list::{List, Nil, Cons}; use std::list; use std::map::HashMap; use std::map; -use std::smallintmap; +use std::oldsmallintmap; use syntax::ast::{provided, required, spanned}; use syntax::ast_map::node_id_to_str; use syntax::ast_util::{local_def, respan, split_trait_methods}; @@ -212,7 +212,7 @@ pub enum crate_ctxt { // Functions that write types into the node type table pub fn write_ty_to_tcx(tcx: ty::ctxt, node_id: ast::node_id, ty: ty::t) { debug!("write_ty_to_tcx(%d, %s)", node_id, ppaux::ty_to_str(tcx, ty)); - smallintmap::insert(*tcx.node_types, node_id as uint, ty); + oldsmallintmap::insert(*tcx.node_types, node_id as uint, ty); } pub fn write_substs_to_tcx(tcx: ty::ctxt, node_id: ast::node_id, diff --git a/src/libstd/smallintmap.rs b/src/libstd/oldsmallintmap.rs similarity index 99% rename from src/libstd/smallintmap.rs rename to src/libstd/oldsmallintmap.rs index 59ae9f68d6e..803e75e4cf7 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/oldsmallintmap.rs @@ -172,7 +172,7 @@ impl SmallIntMap: ops::Index { #[cfg(test)] mod tests { - use smallintmap::{mk, SmallIntMap}; + use super::{mk, SmallIntMap}; use core::option::None; diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 51b55b1c46f..86b0f680234 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -82,7 +82,7 @@ pub mod list; pub mod map; pub mod priority_queue; pub mod rope; -pub mod smallintmap; +pub mod oldsmallintmap; pub mod sort; pub mod treemap; diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs index a72831c2b06..60efb14e2dc 100644 --- a/src/test/bench/std-smallintmap.rs +++ b/src/test/bench/std-smallintmap.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Microbenchmark for the smallintmap library +// Microbenchmark for the oldsmallintmap library extern mod std; -use std::smallintmap; -use std::smallintmap::SmallIntMap; +use std::oldsmallintmap; +use std::oldsmallintmap::SmallIntMap; use io::WriterUtil; fn append_sequential(min: uint, max: uint, map: SmallIntMap) { @@ -43,7 +43,7 @@ fn main() { let mut appendf = 0.0; for uint::range(0u, rep) |_r| { - let map = smallintmap::mk(); + let map = oldsmallintmap::mk(); let start = std::time::precise_time_s(); append_sequential(0u, max, map); let mid = std::time::precise_time_s();