Skip to content

a bit more work on migrating away from oldmap #4854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/libcargo/cargo.rc
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ pub fn configure(opts: Options) -> Cargo {
need_dir(&c.libdir);
need_dir(&c.bindir);

for sources.each_key_ref |&k| {
for sources.each_key |&k| {
let mut s = sources.get(&k);
load_source_packages(&c, s);
sources.insert(k, s);
Expand All @@ -748,7 +748,7 @@ pub fn configure(opts: Options) -> Cargo {
}

pub fn for_each_package(c: &Cargo, b: fn(s: @Source, p: &Package)) {
for c.sources.each_value_ref |&v| {
for c.sources.each_value |&v| {
for v.packages.each |p| {
b(v, p);
}
Expand Down Expand Up @@ -1155,7 +1155,7 @@ pub fn cmd_install(c: &mut Cargo) {
}

pub fn sync(c: &Cargo) {
for c.sources.each_key_ref |&k| {
for c.sources.each_key |&k| {
let mut s = c.sources.get(&k);
sync_one(c, s);
c.sources.insert(k, s);
Expand Down Expand Up @@ -1569,7 +1569,7 @@ pub fn cmd_list(c: &Cargo) {
}
}
} else {
for c.sources.each_value_ref |&v| {
for c.sources.each_value |&v| {
print_source(v);
}
}
Expand Down Expand Up @@ -1636,7 +1636,7 @@ pub fn dump_sources(c: &Cargo) {
result::Ok(writer) => {
let mut hash = ~LinearMap::new();

for c.sources.each_ref |&k, &v| {
for c.sources.each |&k, &v| {
let mut chash = ~LinearMap::new();

chash.insert(~"url", json::String(v.url));
Expand Down Expand Up @@ -1675,7 +1675,7 @@ pub fn copy_warn(srcfile: &Path, destfile: &Path) {

pub fn cmd_sources(c: &Cargo) {
if vec::len(c.opts.free) < 3u {
for c.sources.each_value_ref |&v| {
for c.sources.each_value |&v| {
info(fmt!("%s (%s) via %s",
v.name, v.url, v.method));
}
Expand All @@ -1686,7 +1686,7 @@ pub fn cmd_sources(c: &Cargo) {

match action {
~"clear" => {
for c.sources.each_key_ref |&k| {
for c.sources.each_key |&k| {
c.sources.remove(&k);
}

Expand All @@ -1706,7 +1706,7 @@ pub fn cmd_sources(c: &Cargo) {
return;
}

if c.sources.contains_key_ref(&name) {
if c.sources.contains_key(&name) {
error(fmt!("source already exists: %s", name));
} else {
c.sources.insert(name, @Source {
Expand All @@ -1733,7 +1733,7 @@ pub fn cmd_sources(c: &Cargo) {
return;
}

if c.sources.contains_key_ref(&name) {
if c.sources.contains_key(&name) {
c.sources.remove(&name);
info(fmt!("removed source: %s", name));
} else {
Expand Down
13 changes: 5 additions & 8 deletions src/librustc/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use core::os;
use core::uint;
use core::util;
use core::vec;
use std::oldmap::HashMap;
use std::oldmap;
use core::hashmap::linear::LinearSet;

pure fn not_win32(os: session::os) -> bool {
match os {
Expand Down Expand Up @@ -187,16 +186,14 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
}

pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
let set = oldmap::HashMap();
let mut set = LinearSet::new();
let mut minimized = ~[];
for rpaths.each |rpath| {
let s = rpath.to_str();
if !set.contains_key_ref(&s) {
minimized.push(/*bad*/copy *rpath);
set.insert(s, ());
if set.insert(rpath.to_str()) {
minimized.push(copy *rpath);
}
}
return minimized;
minimized
}

#[cfg(unix)]
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/metadata/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ pub fn set_crate_data(cstore: @mut CStore,
}

pub fn have_crate_data(cstore: @mut CStore, cnum: ast::crate_num) -> bool {
return cstore.metas.contains_key_ref(&cnum);
cstore.metas.contains_key(&cnum)
}

pub fn iter_crate_data(cstore: @mut CStore,
i: fn(ast::crate_num, crate_metadata)) {
let metas = cstore.metas;
for metas.each_ref |&k, &v| {
for metas.each |&k, &v| {
i(k, v);
}
}
Expand Down Expand Up @@ -148,7 +148,7 @@ pub fn get_dep_hashes(cstore: @mut CStore) -> ~[~str] {
let mut result = ~[];

let use_crate_map = cstore.use_crate_map;
for use_crate_map.each_value_ref |&cnum| {
for use_crate_map.each_value |&cnum| {
let cdata = cstore::get_crate_data(cstore, cnum);
let hash = decoder::get_crate_hash(cdata.data);
debug!("Add hash[%s]: %s", cdata.name, hash);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub enum encode_ctxt = {
};

pub fn reachable(ecx: @encode_ctxt, id: node_id) -> bool {
ecx.reachable.contains_key_ref(&id)
ecx.reachable.contains_key(&id)
}

fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/borrowck/check_loans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ fn check_loans_in_expr(expr: @ast::expr,

self.check_for_conflicting_loans(expr.id);

if self.bccx.moves_map.contains_key_ref(&expr.id) {
if self.bccx.moves_map.contains_key(&expr.id) {
self.check_move_out_from_expr(expr);
}

Expand All @@ -710,15 +710,15 @@ fn check_loans_in_expr(expr: @ast::expr,
}
ast::expr_index(_, rval) |
ast::expr_binary(_, _, rval)
if self.bccx.method_map.contains_key_ref(&expr.id) => {
if self.bccx.method_map.contains_key(&expr.id) => {
self.check_call(expr,
None,
expr.callee_id,
expr.span,
~[rval]);
}
ast::expr_unary(*) | ast::expr_index(*)
if self.bccx.method_map.contains_key_ref(&expr.id) => {
if self.bccx.method_map.contains_key(&expr.id) => {
self.check_call(expr,
None,
expr.callee_id,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/gather_loans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn req_loans_in_expr(ex: @ast::expr,
ast::expr_binary(_, rcvr, _) |
ast::expr_unary(_, rcvr) |
ast::expr_assign_op(_, rcvr, _)
if self.bccx.method_map.contains_key_ref(&ex.id) => {
if self.bccx.method_map.contains_key(&ex.id) => {
// Receivers in method calls are always passed by ref.
//
// Here, in an overloaded operator, the call is this expression,
Expand Down Expand Up @@ -244,7 +244,7 @@ fn req_loans_in_expr(ex: @ast::expr,
// }

ast::expr_field(rcvr, _, _)
if self.bccx.method_map.contains_key_ref(&ex.id) => {
if self.bccx.method_map.contains_key(&ex.id) => {
// Receivers in method calls are always passed by ref.
//
// Here, the field a.b is in fact a closure. Eventually, this
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/borrowck/preserve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl PreserveCtxt {
// scope_id;`. Though that would potentially re-introduce
// the ICE. See #3511 for more details.
let scope_to_use = if
self.bccx.stmt_map.contains_key_ref(&scope_id) {
self.bccx.stmt_map.contains_key(&scope_id) {
// Root it in its parent scope, b/c
// trans won't introduce a new scope for the
// stmt
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub fn check_expr(sess: Session,
}
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
expr_binary(_, _, _) | expr_unary(_, _) => {
if method_map.contains_key_ref(&e.id) {
if method_map.contains_key(&e.id) {
sess.span_err(e.span, ~"user-defined operators are not \
allowed in constant expressions");
}
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn expr_is_non_moving_lvalue(cx: @MatchCheckCtxt, expr: @expr) -> bool {
return false;
}

!cx.moves_map.contains_key_ref(&expr.id)
!cx.moves_map.contains_key(&expr.id)
}

pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) {
Expand Down Expand Up @@ -734,7 +734,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
by_ref_span = Some(span);
}
bind_infer => {
if cx.moves_map.contains_key_ref(&id) {
if cx.moves_map.contains_key(&id) {
any_by_move = true;
}
}
Expand Down Expand Up @@ -774,7 +774,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
if pat_is_binding(def_map, p) {
match p.node {
pat_ident(_, _, sub) => {
if cx.moves_map.contains_key_ref(&p.id) {
if cx.moves_map.contains_key(&p.id) {
check_move(p, sub);
}
}
Expand All @@ -800,7 +800,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
behind_bad_pointer);

if behind_bad_pointer &&
cx.moves_map.contains_key_ref(&pat.id)
cx.moves_map.contains_key(&pat.id)
{
cx.tcx.sess.span_err(
pat.span,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/freevars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
}
if i == depth { // Made it to end of loop
let dnum = ast_util::def_id_of_def(def).node;
if !seen.contains_key_ref(&dnum) {
if !seen.contains_key(&dnum) {
refs.push(@freevar_entry {
def: def,
span: expr.span,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl LanguageItemCollector {
}

fn check_completeness() {
for self.item_refs.each_ref |&key, &item_ref| {
for self.item_refs.each |&key, &item_ref| {
match self.items.items[item_ref] {
None => {
self.session.err(fmt!("no item found for `%s`", key));
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
sess: sess});

// Install defaults.
for cx.dict.each_value_ref |&spec| {
for cx.dict.each_value |&spec| {
cx.set_level(spec.lint, spec.default);
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/mem_categorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ pub impl &mem_categorization_ctxt {
let expr_ty = tcx.ty(expr);
match expr.node {
ast::expr_unary(ast::deref, e_base) => {
if self.method_map.contains_key_ref(&expr.id) {
if self.method_map.contains_key(&expr.id) {
return self.cat_rvalue(expr, expr_ty);
}

Expand All @@ -349,7 +349,7 @@ pub impl &mem_categorization_ctxt {
}

ast::expr_field(base, f_name, _) => {
if self.method_map.contains_key_ref(&expr.id) {
if self.method_map.contains_key(&expr.id) {
return self.cat_method_ref(expr, expr_ty);
}

Expand All @@ -358,7 +358,7 @@ pub impl &mem_categorization_ctxt {
}

ast::expr_index(base, _) => {
if self.method_map.contains_key_ref(&expr.id) {
if self.method_map.contains_key(&expr.id) {
return self.cat_rvalue(expr, expr_ty);
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/moves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ impl VisitContext {
arg_exprs: &[@expr],
visitor: vt<VisitContext>) -> bool
{
if !self.method_map.contains_key_ref(&expr.id) {
if !self.method_map.contains_key(&expr.id) {
return false;
}

Expand Down Expand Up @@ -799,7 +799,7 @@ impl VisitContext {
for arm.pats.each |pat| {
let mut found = false;
do pat_bindings(self.tcx.def_map, *pat) |_, node_id, _, _| {
if moves_map.contains_key_ref(&node_id) {
if moves_map.contains_key(&node_id) {
found = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ pub fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
_ => {}
};

if new_cx.root_exprs.contains_key_ref(&expr.id) {
if new_cx.root_exprs.contains_key(&expr.id) {
new_cx.parent = Some(expr.id);
}

Expand Down Expand Up @@ -840,7 +840,7 @@ pub fn determine_rp_in_crate(sess: Session,
debug!("%s", {
debug!("Region variance results:");
let region_paramd_items = cx.region_paramd_items;
for region_paramd_items.each_ref |&key, &value| {
for region_paramd_items.each |&key, &value| {
debug!("item %? (%s) is parameterized with variance %?",
key,
ast_map::node_id_to_str(ast_map, key,
Expand Down
Loading