Skip to content

Commit 3b396d1

Browse files
committed
Merge remote-tracking branch 'thestinger/old_map' into incoming
Conflicts: src/test/bench/core-map.rs
2 parents 04eb9b4 + 4fd9264 commit 3b396d1

File tree

111 files changed

+515
-628
lines changed

Some content is hidden

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

111 files changed

+515
-628
lines changed

doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,10 @@ expression context, the final namespace qualifier is omitted.
448448
Two examples of paths with type arguments:
449449

450450
~~~~
451-
# use std::map;
451+
# use std::oldmap;
452452
# fn f() {
453453
# fn id<T:Copy>(t: T) -> T { t }
454-
type t = map::HashMap<int,~str>; // Type arguments used in a type expression
454+
type t = oldmap::HashMap<int,~str>; // Type arguments used in a type expression
455455
let x = id::<int>(10); // Type arguments used in a call expression
456456
# }
457457
~~~~

doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ illegal to copy and pass by value.
17911791
Generic `type`, `struct`, and `enum` declarations follow the same pattern:
17921792

17931793
~~~~
1794-
# use std::map::HashMap;
1794+
# use std::oldmap::HashMap;
17951795
type Set<T> = HashMap<T, ()>;
17961796
17971797
struct Stack<T> {

src/libcargo/cargo.rc

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ use core::io::WriterUtil;
5353
use core::result::{Ok, Err};
5454
use core::hashmap::linear::LinearMap;
5555
use std::getopts::{optflag, optopt, opt_present};
56-
use std::map::HashMap;
57-
use std::{map, json, tempfile, term, sort, getopts};
56+
use std::oldmap::HashMap;
57+
use std::{oldmap, json, tempfile, term, sort, getopts};
5858
use syntax::codemap::span;
5959
use syntax::diagnostic::span_handler;
6060
use syntax::diagnostic;
@@ -110,9 +110,9 @@ pub struct Cargo {
110110
libdir: Path,
111111
workdir: Path,
112112
sourcedir: Path,
113-
sources: map::HashMap<~str, @Source>,
113+
sources: oldmap::HashMap<~str, @Source>,
114114
mut current_install: ~str,
115-
dep_cache: map::HashMap<~str, bool>,
115+
dep_cache: oldmap::HashMap<~str, bool>,
116116
opts: Options
117117
}
118118

@@ -490,7 +490,7 @@ pub fn parse_source(name: ~str, j: &json::Json) -> @Source {
490490
}
491491

492492
pub fn try_parse_sources(filename: &Path,
493-
sources: map::HashMap<~str, @Source>) {
493+
sources: oldmap::HashMap<~str, @Source>) {
494494
if !os::path_exists(filename) { return; }
495495
let c = io::read_whole_file_str(filename);
496496
match json::from_str(c.get()) {
@@ -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 |k| {
733+
for sources.each_key_ref |&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 |v| {
751+
for c.sources.each_value_ref |&v| {
752752
for v.packages.each |p| {
753753
b(v, p);
754754
}
@@ -833,7 +833,7 @@ pub fn rustc_sysroot() -> ~str {
833833
}
834834
}
835835

836-
pub fn install_source(c: &Cargo, path: &Path) {
836+
pub fn install_source(c: &mut Cargo, path: &Path) {
837837
debug!("source: %s", path.to_str());
838838
os::change_dir(path);
839839

@@ -872,7 +872,8 @@ pub fn install_source(c: &Cargo, path: &Path) {
872872
}
873873
}
874874

875-
pub fn install_git(c: &Cargo, wd: &Path, url: ~str, reference: Option<~str>) {
875+
pub fn install_git(c: &mut Cargo, wd: &Path, url: ~str,
876+
reference: Option<~str>) {
876877
run::program_output(~"git", ~[~"clone", url, wd.to_str()]);
877878
if reference.is_some() {
878879
let r = reference.get();
@@ -883,7 +884,7 @@ pub fn install_git(c: &Cargo, wd: &Path, url: ~str, reference: Option<~str>) {
883884
install_source(c, wd);
884885
}
885886

886-
pub fn install_curl(c: &Cargo, wd: &Path, url: ~str) {
887+
pub fn install_curl(c: &mut Cargo, wd: &Path, url: ~str) {
887888
let tarpath = wd.push("pkg.tar");
888889
let p = run::program_output(~"curl", ~[~"-f", ~"-s", ~"-o",
889890
tarpath.to_str(), url]);
@@ -896,14 +897,14 @@ pub fn install_curl(c: &Cargo, wd: &Path, url: ~str) {
896897
install_source(c, wd);
897898
}
898899

899-
pub fn install_file(c: &Cargo, wd: &Path, path: &Path) {
900+
pub fn install_file(c: &mut Cargo, wd: &Path, path: &Path) {
900901
run::program_output(~"tar", ~[~"-x", ~"--strip-components=1",
901902
~"-C", wd.to_str(),
902903
~"-f", path.to_str()]);
903904
install_source(c, wd);
904905
}
905906

906-
pub fn install_package(c: &Cargo, src: ~str, wd: &Path, pkg: Package) {
907+
pub fn install_package(c: &mut Cargo, src: ~str, wd: &Path, pkg: Package) {
907908
let url = copy pkg.url;
908909
let method = match pkg.method {
909910
~"git" => ~"git",
@@ -922,15 +923,15 @@ pub fn install_package(c: &Cargo, src: ~str, wd: &Path, pkg: Package) {
922923
}
923924

924925
pub fn cargo_suggestion(c: &Cargo, fallback: fn()) {
925-
if c.sources.size() == 0u {
926+
if c.sources.is_empty() {
926927
error(~"no sources defined - you may wish to run " +
927928
~"`cargo init`");
928929
return;
929930
}
930931
fallback();
931932
}
932933

933-
pub fn install_uuid(c: &Cargo, wd: &Path, uuid: ~str) {
934+
pub fn install_uuid(c: &mut Cargo, wd: &Path, uuid: ~str) {
934935
let mut ps = ~[];
935936
for_each_package(c, |s, p| {
936937
if p.uuid == uuid {
@@ -954,7 +955,7 @@ pub fn install_uuid(c: &Cargo, wd: &Path, uuid: ~str) {
954955
}
955956
}
956957

957-
pub fn install_named(c: &Cargo, wd: &Path, name: ~str) {
958+
pub fn install_named(c: &mut Cargo, wd: &Path, name: ~str) {
958959
let mut ps = ~[];
959960
for_each_package(c, |s, p| {
960961
if p.name == name {
@@ -978,7 +979,8 @@ pub fn install_named(c: &Cargo, wd: &Path, name: ~str) {
978979
}
979980
}
980981

981-
pub fn install_uuid_specific(c: &Cargo, wd: &Path, src: ~str, uuid: ~str) {
982+
pub fn install_uuid_specific(c: &mut Cargo, wd: &Path, src: ~str,
983+
uuid: ~str) {
982984
match c.sources.find(src) {
983985
Some(s) => {
984986
for s.packages.each |p| {
@@ -993,7 +995,8 @@ pub fn install_uuid_specific(c: &Cargo, wd: &Path, src: ~str, uuid: ~str) {
993995
error(~"can't find package: " + src + ~"/" + uuid);
994996
}
995997

996-
pub fn install_named_specific(c: &Cargo, wd: &Path, src: ~str, name: ~str) {
998+
pub fn install_named_specific(c: &mut Cargo, wd: &Path, src: ~str,
999+
name: ~str) {
9971000
match c.sources.find(src) {
9981001
Some(s) => {
9991002
for s.packages.each |p| {
@@ -1060,7 +1063,7 @@ pub fn cmd_uninstall(c: &Cargo) {
10601063
}
10611064
}
10621065

1063-
pub fn install_query(c: &Cargo, wd: &Path, target: ~str) {
1066+
pub fn install_query(c: &mut Cargo, wd: &Path, target: ~str) {
10641067
match c.dep_cache.find(target) {
10651068
Some(inst) => {
10661069
if inst {
@@ -1112,10 +1115,7 @@ pub fn install_query(c: &Cargo, wd: &Path, target: ~str) {
11121115
// a bit of a hack. It should be cleaned up in the future.
11131116

11141117
if target == c.current_install {
1115-
for c.dep_cache.each |k, _v| {
1116-
c.dep_cache.remove(k);
1117-
}
1118-
1118+
c.dep_cache.clear();
11191119
c.current_install = ~"";
11201120
}
11211121
}
@@ -1128,7 +1128,7 @@ pub fn get_temp_workdir(c: &Cargo) -> Path {
11281128
}
11291129
}
11301130

1131-
pub fn cmd_install(c: &Cargo) {
1131+
pub fn cmd_install(c: &mut Cargo) {
11321132
unsafe {
11331133
let wd = get_temp_workdir(c);
11341134

@@ -1155,7 +1155,7 @@ pub fn cmd_install(c: &Cargo) {
11551155
}
11561156

11571157
pub fn sync(c: &Cargo) {
1158-
for c.sources.each_key |k| {
1158+
for c.sources.each_key_ref |&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 |v| {
1572+
for c.sources.each_value_ref |&v| {
15731573
print_source(v);
15741574
}
15751575
}
@@ -1620,7 +1620,7 @@ pub fn dump_cache(c: &Cargo) {
16201620
}
16211621

16221622
pub fn dump_sources(c: &Cargo) {
1623-
if c.sources.size() < 1u {
1623+
if c.sources.is_empty() {
16241624
return;
16251625
}
16261626

@@ -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 |k, v| {
1639+
for c.sources.each_ref |&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 |v| {
1678+
for c.sources.each_value_ref |&v| {
16791679
info(fmt!("%s (%s) via %s",
16801680
v.name, v.url, v.method));
16811681
}
@@ -1686,8 +1686,8 @@ pub fn cmd_sources(c: &Cargo) {
16861686

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

16931693
info(~"cleared sources");
@@ -1706,7 +1706,7 @@ pub fn cmd_sources(c: &Cargo) {
17061706
return;
17071707
}
17081708

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

1736-
if c.sources.contains_key(name) {
1737-
c.sources.remove(name);
1736+
if c.sources.contains_key_ref(&name) {
1737+
c.sources.remove(&name);
17381738
info(fmt!("removed source: %s", name));
17391739
} else {
17401740
error(fmt!("no such source: %s", name));
@@ -1825,7 +1825,7 @@ pub fn cmd_sources(c: &Cargo) {
18251825

18261826
match c.sources.find(name) {
18271827
Some(source) => {
1828-
c.sources.remove(name);
1828+
c.sources.remove(&name);
18291829
c.sources.insert(newn, source);
18301830
info(fmt!("renamed source: %s to %s", name, newn));
18311831
}
@@ -1967,7 +1967,7 @@ pub fn main() {
19671967

19681968
match o.free[1] {
19691969
~"init" => cmd_init(&c),
1970-
~"install" => cmd_install(&c),
1970+
~"install" => cmd_install(&mut c),
19711971
~"uninstall" => cmd_uninstall(&c),
19721972
~"list" => cmd_list(&c),
19731973
~"search" => cmd_search(&c),

src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use core::ptr;
3636
use core::run;
3737
use core::str;
3838
use core::vec;
39-
use std::map::HashMap;
39+
use std::oldmap::HashMap;
4040
use std::sha1::sha1;
4141
use syntax::ast;
4242
use syntax::ast_map::{path, path_mod, path_name};

src/librustc/back/rpath.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use core::os;
1818
use core::uint;
1919
use core::util;
2020
use core::vec;
21-
use std::map::HashMap;
22-
use std::map;
21+
use std::oldmap::HashMap;
22+
use std::oldmap;
2323

2424
pure fn not_win32(os: session::os) -> bool {
2525
match os {
@@ -187,7 +187,7 @@ pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
187187
}
188188
189189
pub fn minimize_rpaths(rpaths: &[Path]) -> ~[Path] {
190-
let set = map::HashMap();
190+
let set = oldmap::HashMap();
191191
let mut minimized = ~[];
192192
for rpaths.each |rpath| {
193193
let s = rpath.to_str();

src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use std::getopts::groups::{optopt, optmulti, optflag, optflagopt, getopts};
3535
use std::getopts::groups;
3636
use std::getopts::{opt_present};
3737
use std::getopts;
38-
use std::map::HashMap;
38+
use std::oldmap::HashMap;
3939
use std;
4040
use syntax::ast;
4141
use syntax::ast_map;

src/librustc/lib/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use core::ptr;
2020
use core::str;
2121
use core::uint;
2222
use core::vec;
23-
use std::map::HashMap;
23+
use std::oldmap::HashMap;
2424

2525
pub type Opcode = u32;
2626
pub type Bool = c_uint;

src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use syntax::parse::token::ident_interner;
3030
use syntax::print::pprust;
3131
use syntax::visit;
3232
use syntax::{ast, ast_util};
33-
use std::map::HashMap;
33+
use std::oldmap::HashMap;
3434

3535
// Traverses an AST, reading all the information about use'd crates and extern
3636
// libraries necessary for later resolving, typechecking, linking, etc.

src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use core::dvec::DVec;
2323
use core::vec;
2424
use reader = std::ebml::reader;
2525
use std::ebml;
26-
use std::map::HashMap;
26+
use std::oldmap::HashMap;
2727
use syntax::ast;
2828
use syntax::ast_map;
2929
use syntax::codemap::dummy_sp;

0 commit comments

Comments
 (0)