Skip to content

Commit 26b43e6

Browse files
committed
---
yaml --- r: 14698 b: refs/heads/try c: c245d9e h: refs/heads/master v: v3
1 parent f6d5f6b commit 26b43e6

Some content is hidden

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

50 files changed

+48
-96
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: f0250a23d3fa2f8b4a4a4113ca89e41945a4cfed
5+
refs/heads/try: c245d9e980946d4472e9c830a109db77e1bcb038
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/cargo/cargo.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import io::writer_util;
1616
import std::json;
1717
import result;
1818
import std::map;
19-
import std::map::hashmap;
2019
import std::os;
2120
import std::run;
2221
import str;

branches/try/src/libstd/json.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import result::{ok, err};
55
import io;
66
import io::{reader_util, writer_util};
77
import map;
8-
import map::hashmap;
98

109
export json;
1110
export error;
@@ -37,7 +36,7 @@ enum json {
3736
/* Variant: list */
3837
list([json]),
3938
/* Variant: dict */
40-
dict(map::hashmap<str,json>),
39+
dict(map::map<str,json>),
4140
/* Variant: null */
4241
null,
4342
}

branches/try/src/libstd/map.rs

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ Module: map
44
A map type
55
*/
66

7-
import chained::hashmap;
8-
export hashmap, hashfn, eqfn, set, map, chained, mk_hashmap, new_str_hash;
9-
export new_bytes_hash, new_int_hash, new_uint_hash, set_add;
10-
117
/* Section: Types */
128

139
/*
@@ -27,13 +23,14 @@ Equality
2723
type eqfn<K> = fn@(K, K) -> bool;
2824

2925
/*
30-
Type: set
26+
Type: hashset
3127
32-
A convenience type to treat a hashmap as a set
28+
A convenience type to treat a map as a set
3329
*/
34-
type set<K> = hashmap<K, ()>;
30+
type set<K> = map<K, ()>;
3531

36-
type hashmap<K, V> = chained::t<K, V>;
32+
// Temporary alias to make migration easier
33+
type hashmap<K, V> = map<K, V>;
3734

3835
/*
3936
IFace: map
@@ -106,7 +103,8 @@ iface map<K: copy, V: copy> {
106103
}
107104

108105
// FIXME: package this up and export it as a datatype usable for
109-
// external code that doesn't want to pay the cost of a box.
106+
// external code that doesn't want to pay the cost of a box and vtable
107+
// lookups.
110108
mod chained {
111109
type entry<K, V> = {
112110
hash: uint,
@@ -120,8 +118,8 @@ mod chained {
120118
absent
121119
}
122120

123-
type t<K, V> = @{
124-
mutable count: uint,
121+
type t<K, V> = {
122+
mutable size: uint,
125123
mutable chains: [mutable chain<K,V>],
126124
hasher: hashfn<K>,
127125
eqer: eqfn<K>
@@ -187,7 +185,7 @@ mod chained {
187185
let hash = tbl.hasher(k);
188186
alt search_tbl(tbl, k, hash) {
189187
not_found {
190-
tbl.count += 1u;
188+
tbl.size += 1u;
191189
let idx = hash % vec::len(tbl.chains);
192190
let old_chain = tbl.chains[idx];
193191
tbl.chains[idx] = present(@{
@@ -231,13 +229,13 @@ mod chained {
231229
}
232230

233231
found_first(idx, entry) {
234-
tbl.count -= 1u;
232+
tbl.size -= 1u;
235233
tbl.chains[idx] = entry.next;
236234
ret core::option::some(entry.value);
237235
}
238236

239237
found_after(eprev, entry) {
240-
tbl.count -= 1u;
238+
tbl.size -= 1u;
241239
eprev.next = entry.next;
242240
ret core::option::some(entry.value);
243241
}
@@ -293,12 +291,12 @@ mod chained {
293291
}
294292
}
295293

296-
impl hashmap<K: copy, V: copy> of map<K, V> for t<K, V> {
297-
fn size() -> uint { self.count }
294+
impl <K: copy, V: copy> of map<K, V> for t<K, V> {
295+
fn size() -> uint { self.size }
298296

299297
fn insert(k: K, v: V) -> bool {
300298
let nchains = vec::len(self.chains);
301-
let load = {num: (self.count + 1u) as int, den: nchains as int};
299+
let load = {num: (self.size + 1u) as int, den: nchains as int};
302300
// Structural consts would be nice. This is a const 3/4
303301
// load factor that we compare against.
304302
if !util::rational_leq(load, {num:3, den:4}) { rehash(self); }
@@ -320,13 +318,13 @@ mod chained {
320318
fn values(blk: fn(V)) { items(self) { |_k, v| blk(v) } }
321319
}
322320

323-
fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> t<K,V> {
321+
fn mk<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>) -> map<K,V> {
324322
let initial_capacity: uint = 32u; // 2^5
325-
let slf: t<K, V> = @{mutable count: 0u,
326-
mutable chains: chains(initial_capacity),
327-
hasher: hasher,
328-
eqer: eqer};
329-
slf
323+
let slf: t<K, V> = {mutable size: 0u,
324+
mutable chains: chains(initial_capacity),
325+
hasher: hasher,
326+
eqer: eqer};
327+
slf as map::<K, V>
330328
}
331329
}
332330

@@ -341,7 +339,7 @@ hasher - The hash function for key type K
341339
eqer - The equality function for key type K
342340
*/
343341
fn mk_hashmap<K: copy, V: copy>(hasher: hashfn<K>, eqer: eqfn<K>)
344-
-> hashmap<K, V> {
342+
-> map<K, V> {
345343
chained::mk(hasher, eqer)
346344
}
347345

@@ -350,7 +348,7 @@ Function: new_str_hash
350348
351349
Construct a hashmap for string keys
352350
*/
353-
fn new_str_hash<V: copy>() -> hashmap<str, V> {
351+
fn new_str_hash<V: copy>() -> map<str, V> {
354352
ret mk_hashmap(str::hash, str::eq);
355353
}
356354

@@ -359,7 +357,7 @@ Function: new_bytes_hash
359357
360358
Construct a hashmap for byte string keys
361359
*/
362-
fn new_bytes_hash<V: copy>() -> hashmap<[u8], V> {
360+
fn new_bytes_hash<V: copy>() -> map<[u8], V> {
363361
ret mk_hashmap(vec::u8::hash, vec::u8::eq);
364362
}
365363

@@ -368,7 +366,7 @@ Function: new_int_hash
368366
369367
Construct a hashmap for int keys
370368
*/
371-
fn new_int_hash<V: copy>() -> hashmap<int, V> {
369+
fn new_int_hash<V: copy>() -> map<int, V> {
372370
fn hash_int(&&x: int) -> uint { int::hash(x) }
373371
fn eq_int(&&a: int, &&b: int) -> bool { ret a == b; }
374372
ret mk_hashmap(hash_int, eq_int);
@@ -379,7 +377,7 @@ Function: new_uint_hash
379377
380378
Construct a hashmap for uint keys
381379
*/
382-
fn new_uint_hash<V: copy>() -> hashmap<uint, V> {
380+
fn new_uint_hash<V: copy>() -> map<uint, V> {
383381
fn hash_uint(&&x: uint) -> uint { uint::hash(x) }
384382
fn eq_uint(&&a: uint, &&b: uint) -> bool { ret a == b; }
385383
ret mk_hashmap(hash_uint, eq_uint);

branches/try/src/libstd/uv.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import map::hashmap;
21
export loop_new, loop_delete, run, close, run_in_bg;
32
export async_init, async_send;
43
export timer_init, timer_start, timer_stop;
@@ -130,17 +129,17 @@ fn loop_new() -> uv_loop unsafe {
130129
process_operation);
131130

132131
// all state goes here
133-
let handles: map::hashmap<[u8], *ctypes::void> =
132+
let handles: map::map<[u8], *ctypes::void> =
134133
map::new_bytes_hash();
135-
let id_to_handle: map::hashmap<[u8], uv_handle> =
134+
let id_to_handle: map::map<[u8], uv_handle> =
136135
map::new_bytes_hash();
137-
let after_cbs: map::hashmap<[u8], fn~(uv_handle)> =
136+
let after_cbs: map::map<[u8], fn~(uv_handle)> =
138137
map::new_bytes_hash();
139-
let close_callbacks: map::hashmap<[u8], fn~()> =
138+
let close_callbacks: map::map<[u8], fn~()> =
140139
map::new_bytes_hash();
141-
let async_cbs: map::hashmap<[u8], fn~(uv_handle)> =
140+
let async_cbs: map::map<[u8], fn~(uv_handle)> =
142141
map::new_bytes_hash();
143-
let timer_cbs: map::hashmap<[u8], fn~(uv_handle)> =
142+
let timer_cbs: map::map<[u8], fn~(uv_handle)> =
144143
map::new_bytes_hash();
145144

146145
// the main loop that this task blocks on.

branches/try/src/rustc/back/link.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import middle::ty;
77
import metadata::{encoder, cstore};
88
import middle::trans::common::crate_ctxt;
99
import std::fs;
10-
import std::map::hashmap;
1110
import std::run;
1211
import std::sha1::sha1;
1312
import syntax::ast;

branches/try/src/rustc/back/rpath.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import std::{os, fs, os_fs, map};
2-
import std::map::hashmap;
32
import metadata::cstore;
43
import driver::session;
54
import util::filesearch;

branches/try/src/rustc/front/attr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Functions dealing with attributes and meta_items
22

33
import std::map;
4-
import std::map::hashmap;
54
import syntax::{ast, ast_util};
65
import driver::session::session;
76

branches/try/src/rustc/lib/llvm.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import str::sbuf;
2-
import std::map::hashmap;
32

43
import ctypes::{c_int, c_uint, unsigned, longlong, ulonglong};
54

branches/try/src/rustc/metadata/astencode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import syntax::visit;
44
import syntax::ast_util;
55
import syntax::ast_util::inlined_item_methods;
66
import syntax::codemap::span;
7+
import std::map::map;
8+
import std::smallintmap::map;
79
import std::ebml;
810
import std::ebml::writer;
9-
import std::map::hashmap;
1011
import std::serialization;
1112
import std::serialization::serializer;
1213
import std::serialization::deserializer;
1314
import std::serialization::serializer_helpers;
1415
import std::serialization::deserializer_helpers;
15-
import std::smallintmap::map;
1616
import middle::trans::common::maps;
1717
import middle::{ty, typeck, last_use, ast_map};
1818
import middle::typeck::method_origin;
@@ -922,4 +922,4 @@ fn test_more() {
922922
ret z;
923923
}
924924
});
925-
}
925+
}

branches/try/src/rustc/metadata/csearch.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import middle::{ty, ast_map};
66
import option::{some, none};
77
import driver::session;
88
import middle::trans::common::maps;
9-
import std::map::hashmap;
109

1110
export get_symbol;
1211
export get_type_param_count;

branches/try/src/rustc/metadata/cstore.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// crates and libraries
33

44
import std::map;
5-
import std::map::hashmap;
65
import syntax::ast;
76
import util::common::*;
87

branches/try/src/rustc/metadata/decoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Decoding metadata from a single crate's metadata
22

33
import std::{ebml, map, io};
4-
import std::map::hashmap;
54
import io::writer_util;
65
import syntax::{ast, ast_util};
76
import driver::session::session;

branches/try/src/rustc/metadata/encoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Metadata encoding
22

33
import std::{io, ebml, map, list};
4-
import std::map::hashmap;
54
import io::writer_util;
65
import ebml::writer;
76
import syntax::ast::*;

branches/try/src/rustc/metadata/reachable.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import syntax::ast::*;
1010
import syntax::visit;
1111
import syntax::ast_util::def_id_of_def;
1212
import front::attr;
13-
import std::map::hashmap;
1413

1514
export map, find_reachable;
1615

17-
type map = std::map::hashmap<node_id, ()>;
16+
type map = std::map::map<node_id, ()>;
1817

1918
type ctx = {ccx: middle::trans::common::crate_ctxt,
2019
rmap: map};

branches/try/src/rustc/metadata/tydecode.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import syntax::ast::*;
55
import syntax::ast_util;
66
import syntax::ast_util::respan;
77
import middle::ty;
8-
import std::map::hashmap;
98

109
export parse_ty_data, parse_def_id;
1110
export parse_bounds_data;

branches/try/src/rustc/middle/alias.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import syntax::codemap::span;
55
import syntax::visit;
66
import visit::vt;
77
import std::list;
8-
import std::map::hashmap;
98
import std::util::unreachable;
109
import option::is_none;
1110
import list::list;

branches/try/src/rustc/middle/ast_map.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import std::map;
2-
import std::map::hashmap;
32
import syntax::ast::*;
43
import syntax::ast_util;
54
import syntax::ast_util::inlined_item_methods;
@@ -36,7 +35,7 @@ enum ast_node {
3635
node_res_ctor(@item),
3736
}
3837

39-
type map = std::map::hashmap<node_id, ast_node>;
38+
type map = std::map::map<node_id, ast_node>;
4039
type ctx = {map: map, mutable path: path, mutable local_id: uint};
4140
type vt = visit::vt<ctx>;
4241

branches/try/src/rustc/middle/capture.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import syntax::{ast, ast_util};
22
import driver::session::session;
33
import std::map;
4-
import std::map::hashmap;
54

65
export capture_mode;
76
export capture_var;

branches/try/src/rustc/middle/check_alt.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import syntax::visit;
88
import driver::session::session;
99
import middle::ty;
1010
import middle::ty::*;
11-
import std::map::hashmap;
1211

1312
fn check_crate(tcx: ty::ctxt, crate: @crate) {
1413
visit::visit_crate(*crate, (), visit::mk_vt(@{

branches/try/src/rustc/middle/check_const.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import syntax::ast::*;
22
import syntax::{visit, ast_util};
33
import driver::session::session;
4-
import std::map::hashmap;
54

65
fn check_crate(sess: session, crate: @crate, method_map: typeck::method_map) {
76
visit::visit_crate(*crate, false, visit::mk_vt(@{

branches/try/src/rustc/middle/fn_usage.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import std::map::hashmap;
21
import syntax::ast;
32
import syntax::visit;
43
import syntax::print::pprust::expr_to_str;

branches/try/src/rustc/middle/kind.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import syntax::ast::*;
33
import syntax::codemap::span;
44
import ty::{kind, kind_copyable, kind_sendable, kind_noncopyable};
55
import driver::session::session;
6-
import std::map::hashmap;
76

87
// Kind analysis pass. There are three kinds:
98
//

branches/try/src/rustc/middle/last_use.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import syntax::codemap::span;
44
import std::list::{is_not_empty, list, nil, cons, tail};
55
import std::util::unreachable;
66
import std::list;
7-
import std::map::hashmap;
87

98
// Last use analysis pass.
109
//

branches/try/src/rustc/middle/lint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import middle::ty::ctxt;
33
import syntax::{ast, visit};
44
import front::attr;
55
import std::io;
6-
import std::map::hashmap;
76
import io::writer_util;
87

98
enum option {

0 commit comments

Comments
 (0)