Skip to content

Commit d6442e9

Browse files
committed
auto merge of #4854 : thestinger/rust/oldmap, r=catamorphism
2 parents 7fe6b1b + 4e6994d commit d6442e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+188
-201
lines changed

src/libcargo/cargo.rc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ pub fn configure(opts: Options) -> Cargo {
730730
need_dir(&c.libdir);
731731
need_dir(&c.bindir);
732732

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

750750
pub fn for_each_package(c: &Cargo, b: fn(s: @Source, p: &Package)) {
751-
for c.sources.each_value_ref |&v| {
751+
for c.sources.each_value |&v| {
752752
for v.packages.each |p| {
753753
b(v, p);
754754
}
@@ -1155,7 +1155,7 @@ pub fn cmd_install(c: &mut Cargo) {
11551155
}
11561156

11571157
pub fn sync(c: &Cargo) {
1158-
for c.sources.each_key_ref |&k| {
1158+
for c.sources.each_key |&k| {
11591159
let mut s = c.sources.get(&k);
11601160
sync_one(c, s);
11611161
c.sources.insert(k, s);
@@ -1569,7 +1569,7 @@ pub fn cmd_list(c: &Cargo) {
15691569
}
15701570
}
15711571
} else {
1572-
for c.sources.each_value_ref |&v| {
1572+
for c.sources.each_value |&v| {
15731573
print_source(v);
15741574
}
15751575
}
@@ -1636,7 +1636,7 @@ pub fn dump_sources(c: &Cargo) {
16361636
result::Ok(writer) => {
16371637
let mut hash = ~LinearMap::new();
16381638

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

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

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

16871687
match action {
16881688
~"clear" => {
1689-
for c.sources.each_key_ref |&k| {
1689+
for c.sources.each_key |&k| {
16901690
c.sources.remove(&k);
16911691
}
16921692

@@ -1706,7 +1706,7 @@ pub fn cmd_sources(c: &Cargo) {
17061706
return;
17071707
}
17081708

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

1736-
if c.sources.contains_key_ref(&name) {
1736+
if c.sources.contains_key(&name) {
17371737
c.sources.remove(&name);
17381738
info(fmt!("removed source: %s", name));
17391739
} else {

src/librustc/back/rpath.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ use core::os;
1818
use core::uint;
1919
use core::util;
2020
use core::vec;
21-
use std::oldmap::HashMap;
22-
use std::oldmap;
21+
use core::hashmap::linear::LinearSet;
2322

2423
pure fn not_win32(os: session::os) -> bool {
2524
match os {
@@ -187,16 +186,14 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
187186
}
188187
189188
pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
190-
let set = oldmap::HashMap();
189+
let mut set = LinearSet::new();
191190
let mut minimized = ~[];
192191
for rpaths.each |rpath| {
193-
let s = rpath.to_str();
194-
if !set.contains_key_ref(&s) {
195-
minimized.push(/*bad*/copy *rpath);
196-
set.insert(s, ());
192+
if set.insert(rpath.to_str()) {
193+
minimized.push(copy *rpath);
197194
}
198195
}
199-
return minimized;
196+
minimized
200197
}
201198
202199
#[cfg(unix)]

src/librustc/metadata/cstore.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ pub fn set_crate_data(cstore: @mut CStore,
8686
}
8787

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

9292
pub fn iter_crate_data(cstore: @mut CStore,
9393
i: fn(ast::crate_num, crate_metadata)) {
9494
let metas = cstore.metas;
95-
for metas.each_ref |&k, &v| {
95+
for metas.each |&k, &v| {
9696
i(k, v);
9797
}
9898
}
@@ -148,7 +148,7 @@ pub fn get_dep_hashes(cstore: @mut CStore) -> ~[~str] {
148148
let mut result = ~[];
149149

150150
let use_crate_map = cstore.use_crate_map;
151-
for use_crate_map.each_value_ref |&cnum| {
151+
for use_crate_map.each_value |&cnum| {
152152
let cdata = cstore::get_crate_data(cstore, cnum);
153153
let hash = decoder::get_crate_hash(cdata.data);
154154
debug!("Add hash[%s]: %s", cdata.name, hash);

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub enum encode_ctxt = {
9999
};
100100

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

105105
fn encode_name(ecx: @encode_ctxt, ebml_w: writer::Encoder, name: ident) {

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ fn check_loans_in_expr(expr: @ast::expr,
689689

690690
self.check_for_conflicting_loans(expr.id);
691691

692-
if self.bccx.moves_map.contains_key_ref(&expr.id) {
692+
if self.bccx.moves_map.contains_key(&expr.id) {
693693
self.check_move_out_from_expr(expr);
694694
}
695695

@@ -710,15 +710,15 @@ fn check_loans_in_expr(expr: @ast::expr,
710710
}
711711
ast::expr_index(_, rval) |
712712
ast::expr_binary(_, _, rval)
713-
if self.bccx.method_map.contains_key_ref(&expr.id) => {
713+
if self.bccx.method_map.contains_key(&expr.id) => {
714714
self.check_call(expr,
715715
None,
716716
expr.callee_id,
717717
expr.span,
718718
~[rval]);
719719
}
720720
ast::expr_unary(*) | ast::expr_index(*)
721-
if self.bccx.method_map.contains_key_ref(&expr.id) => {
721+
if self.bccx.method_map.contains_key(&expr.id) => {
722722
self.check_call(expr,
723723
None,
724724
expr.callee_id,

src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fn req_loans_in_expr(ex: @ast::expr,
207207
ast::expr_binary(_, rcvr, _) |
208208
ast::expr_unary(_, rcvr) |
209209
ast::expr_assign_op(_, rcvr, _)
210-
if self.bccx.method_map.contains_key_ref(&ex.id) => {
210+
if self.bccx.method_map.contains_key(&ex.id) => {
211211
// Receivers in method calls are always passed by ref.
212212
//
213213
// Here, in an overloaded operator, the call is this expression,
@@ -244,7 +244,7 @@ fn req_loans_in_expr(ex: @ast::expr,
244244
// }
245245

246246
ast::expr_field(rcvr, _, _)
247-
if self.bccx.method_map.contains_key_ref(&ex.id) => {
247+
if self.bccx.method_map.contains_key(&ex.id) => {
248248
// Receivers in method calls are always passed by ref.
249249
//
250250
// Here, the field a.b is in fact a closure. Eventually, this

src/librustc/middle/borrowck/preserve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl PreserveCtxt {
375375
// scope_id;`. Though that would potentially re-introduce
376376
// the ICE. See #3511 for more details.
377377
let scope_to_use = if
378-
self.bccx.stmt_map.contains_key_ref(&scope_id) {
378+
self.bccx.stmt_map.contains_key(&scope_id) {
379379
// Root it in its parent scope, b/c
380380
// trans won't introduce a new scope for the
381381
// stmt

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn check_expr(sess: Session,
102102
}
103103
expr_lit(@codemap::spanned {node: lit_str(_), _}) => { }
104104
expr_binary(_, _, _) | expr_unary(_, _) => {
105-
if method_map.contains_key_ref(&e.id) {
105+
if method_map.contains_key(&e.id) {
106106
sess.span_err(e.span, ~"user-defined operators are not \
107107
allowed in constant expressions");
108108
}

src/librustc/middle/check_match.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn expr_is_non_moving_lvalue(cx: @MatchCheckCtxt, expr: @expr) -> bool {
5959
return false;
6060
}
6161

62-
!cx.moves_map.contains_key_ref(&expr.id)
62+
!cx.moves_map.contains_key(&expr.id)
6363
}
6464

6565
pub fn check_expr(cx: @MatchCheckCtxt, ex: @expr, &&s: (), v: visit::vt<()>) {
@@ -734,7 +734,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
734734
by_ref_span = Some(span);
735735
}
736736
bind_infer => {
737-
if cx.moves_map.contains_key_ref(&id) {
737+
if cx.moves_map.contains_key(&id) {
738738
any_by_move = true;
739739
}
740740
}
@@ -774,7 +774,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
774774
if pat_is_binding(def_map, p) {
775775
match p.node {
776776
pat_ident(_, _, sub) => {
777-
if cx.moves_map.contains_key_ref(&p.id) {
777+
if cx.moves_map.contains_key(&p.id) {
778778
check_move(p, sub);
779779
}
780780
}
@@ -800,7 +800,7 @@ pub fn check_legality_of_move_bindings(cx: @MatchCheckCtxt,
800800
behind_bad_pointer);
801801
802802
if behind_bad_pointer &&
803-
cx.moves_map.contains_key_ref(&pat.id)
803+
cx.moves_map.contains_key(&pat.id)
804804
{
805805
cx.tcx.sess.span_err(
806806
pat.span,

src/librustc/middle/freevars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn collect_freevars(def_map: resolve::DefMap, blk: ast::blk)
6969
}
7070
if i == depth { // Made it to end of loop
7171
let dnum = ast_util::def_id_of_def(def).node;
72-
if !seen.contains_key_ref(&dnum) {
72+
if !seen.contains_key(&dnum) {
7373
refs.push(@freevar_entry {
7474
def: def,
7575
span: expr.span,

src/librustc/middle/lang_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl LanguageItemCollector {
391391
}
392392

393393
fn check_completeness() {
394-
for self.item_refs.each_ref |&key, &item_ref| {
394+
for self.item_refs.each |&key, &item_ref| {
395395
match self.items.items[item_ref] {
396396
None => {
397397
self.session.err(fmt!("no item found for `%s`", key));

src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
400400
sess: sess});
401401

402402
// Install defaults.
403-
for cx.dict.each_value_ref |&spec| {
403+
for cx.dict.each_value |&spec| {
404404
cx.set_level(spec.lint, spec.default);
405405
}
406406

src/librustc/middle/mem_categorization.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub impl &mem_categorization_ctxt {
340340
let expr_ty = tcx.ty(expr);
341341
match expr.node {
342342
ast::expr_unary(ast::deref, e_base) => {
343-
if self.method_map.contains_key_ref(&expr.id) {
343+
if self.method_map.contains_key(&expr.id) {
344344
return self.cat_rvalue(expr, expr_ty);
345345
}
346346

@@ -349,7 +349,7 @@ pub impl &mem_categorization_ctxt {
349349
}
350350

351351
ast::expr_field(base, f_name, _) => {
352-
if self.method_map.contains_key_ref(&expr.id) {
352+
if self.method_map.contains_key(&expr.id) {
353353
return self.cat_method_ref(expr, expr_ty);
354354
}
355355

@@ -358,7 +358,7 @@ pub impl &mem_categorization_ctxt {
358358
}
359359

360360
ast::expr_index(base, _) => {
361-
if self.method_map.contains_key_ref(&expr.id) {
361+
if self.method_map.contains_key(&expr.id) {
362362
return self.cat_rvalue(expr, expr_ty);
363363
}
364364

src/librustc/middle/moves.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ impl VisitContext {
668668
arg_exprs: &[@expr],
669669
visitor: vt<VisitContext>) -> bool
670670
{
671-
if !self.method_map.contains_key_ref(&expr.id) {
671+
if !self.method_map.contains_key(&expr.id) {
672672
return false;
673673
}
674674

@@ -799,7 +799,7 @@ impl VisitContext {
799799
for arm.pats.each |pat| {
800800
let mut found = false;
801801
do pat_bindings(self.tcx.def_map, *pat) |_, node_id, _, _| {
802-
if moves_map.contains_key_ref(&node_id) {
802+
if moves_map.contains_key(&node_id) {
803803
found = true;
804804
}
805805
}

src/librustc/middle/region.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ pub fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
296296
_ => {}
297297
};
298298

299-
if new_cx.root_exprs.contains_key_ref(&expr.id) {
299+
if new_cx.root_exprs.contains_key(&expr.id) {
300300
new_cx.parent = Some(expr.id);
301301
}
302302

@@ -840,7 +840,7 @@ pub fn determine_rp_in_crate(sess: Session,
840840
debug!("%s", {
841841
debug!("Region variance results:");
842842
let region_paramd_items = cx.region_paramd_items;
843-
for region_paramd_items.each_ref |&key, &value| {
843+
for region_paramd_items.each |&key, &value| {
844844
debug!("item %? (%s) is parameterized with variance %?",
845845
key,
846846
ast_map::node_id_to_str(ast_map, key,

0 commit comments

Comments
 (0)