Skip to content

Commit e949aab

Browse files
committed
Remove some rustboot-isms
Closes #464
1 parent 48013db commit e949aab

File tree

7 files changed

+18
-36
lines changed

7 files changed

+18
-36
lines changed

src/comp/metadata/encoder.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -585,19 +585,15 @@ fn encode_metadata(&@crate_ctxt cx, &@crate crate) -> str {
585585

586586
ebmlivec::start_tag(ebml_w, tag_paths);
587587
auto paths_index = encode_item_paths(ebml_w, crate);
588-
auto str_writer = write_str;
589-
auto path_hasher = hash_path;
590-
auto paths_buckets = create_index[str](paths_index, path_hasher);
591-
encode_index[str](ebml_w, paths_buckets, str_writer);
588+
auto paths_buckets = create_index(paths_index, hash_path);
589+
encode_index(ebml_w, paths_buckets, write_str);
592590
ebmlivec::end_tag(ebml_w);
593591
// Encode and index the items.
594592

595593
ebmlivec::start_tag(ebml_w, tag_items);
596594
auto items_index = encode_info_for_items(ecx, ebml_w);
597-
auto int_writer = write_int;
598-
auto item_hasher = hash_node_id;
599-
auto items_buckets = create_index[int](items_index, item_hasher);
600-
encode_index[int](ebml_w, items_buckets, int_writer);
595+
auto items_buckets = create_index(items_index, hash_node_id);
596+
encode_index(ebml_w, items_buckets, write_int);
601597
ebmlivec::end_tag(ebml_w);
602598
// Pad this, since something (LLVM, presumably) is cutting off the
603599
// remaining % 4 bytes_ivec.

src/comp/middle/trans.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,10 +2261,9 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
22612261
T_glue_fn(*lcx.ccx),
22622262
"copy");
22632263
ti.copy_glue = some[ValueRef](glue_fn);
2264-
auto tg = make_copy_glue;
22652264
make_generic_glue(lcx, cx.sp, ti.ty, glue_fn,
2266-
mgghf_single(tg), ti.ty_params,
2267-
"take");
2265+
mgghf_single(make_copy_glue),
2266+
ti.ty_params, "take");
22682267
log #fmt("--- lazily_emit_tydesc_glue TAKE %s",
22692268
ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
22702269
}
@@ -2300,10 +2299,9 @@ fn lazily_emit_tydesc_glue(&@block_ctxt cx, int field,
23002299
T_glue_fn(*lcx.ccx),
23012300
"free");
23022301
ti.free_glue = some[ValueRef](glue_fn);
2303-
auto dg = make_free_glue;
23042302
make_generic_glue(lcx, cx.sp, ti.ty, glue_fn,
2305-
mgghf_single(dg), ti.ty_params,
2306-
"free");
2303+
mgghf_single(make_free_glue),
2304+
ti.ty_params, "free");
23072305
log #fmt("--- lazily_emit_tydesc_glue FREE %s",
23082306
ty_to_str(cx.fcx.lcx.ccx.tcx, ti.ty));
23092307
}

src/comp/middle/ty.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,7 @@ fn mk_rcache() -> creader_cache {
392392
bool {
393393
ret a._0 == b._0 && a._1 == b._1 && a._2 == b._2;
394394
}
395-
auto h = hash_cache_entry;
396-
auto e = eq_cache_entries;
397-
ret map::mk_hashmap[tup(int, uint, uint), t](h, e);
395+
ret map::mk_hashmap(hash_cache_entry, eq_cache_entries);
398396
}
399397

400398

@@ -2618,8 +2616,7 @@ mod unify {
26182616
alt (unify_mut(expected_elem.mut,
26192617
actual_elem.mut)) {
26202618
case (none) {
2621-
auto err = terr_tuple_mutability;
2622-
ret ures_err(err);
2619+
ret ures_err(terr_tuple_mutability);
26232620
}
26242621
case (some(?m)) { mut = m; }
26252622
}

src/comp/syntax/parse/parser.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ fn parse_ty_obj(&parser p, &mutable uint hi) -> ast::ty_ {
312312
}
313313
fail;
314314
}
315-
auto f = parse_method_sig;
316-
auto meths = parse_seq(token::LBRACE, token::RBRACE, none, f, p);
315+
auto meths = parse_seq(token::LBRACE, token::RBRACE, none,
316+
parse_method_sig, p);
317317
hi = meths.span.hi;
318318
ret ast::ty_obj(meths.node);
319319
}
@@ -1505,9 +1505,8 @@ fn parse_pat(&parser p) -> @ast::pat {
15051505
let (@ast::pat)[] args;
15061506
alt (p.peek()) {
15071507
case (token::LPAREN) {
1508-
auto f = parse_pat;
15091508
auto a = parse_seq(token::LPAREN, token::RPAREN,
1510-
some(token::COMMA), f, p);
1509+
some(token::COMMA), parse_pat, p);
15111510
args = a.node;
15121511
hi = a.span.hi;
15131512
}

src/lib/io.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ obj new_reader(buf_reader rdr) {
156156
}
157157

158158
// FIXME deal with eof?
159-
fn read_be_uint(uint size) -> uint {
159+
fn read_be_uint(uint sz) -> uint {
160160
auto val = 0u;
161-
auto sz = size; // FIXME: trans::ml bug workaround
162161

163162
while (sz > 0u) {
164163
sz -= 1u;

src/lib/ioivec.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,8 @@ obj new_reader(buf_reader rdr) {
157157
}
158158

159159
// FIXME deal with eof?
160-
fn read_be_uint(uint size) -> uint {
160+
fn read_be_uint(uint sz) -> uint {
161161
auto val = 0u;
162-
auto sz = size; // FIXME: trans::ml bug workaround
163162

164163
while (sz > 0u) {
165164
sz -= 1u;

src/lib/map.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,25 +209,19 @@ fn mk_hashmap[K, V](&hashfn[K] hasher, &eqfn[K] eqer) -> hashmap[K, V] {
209209
// Hash map constructors for basic types
210210

211211
fn new_str_hash[V]() -> hashmap[str, V] {
212-
let hashfn[str] hasher = str::hash;
213-
let eqfn[str] eqer = str::eq;
214-
ret mk_hashmap[str, V](hasher, eqer);
212+
ret mk_hashmap(str::hash, str::eq);
215213
}
216214

217215
fn new_int_hash[V]() -> hashmap[int, V] {
218216
fn hash_int(&int x) -> uint { ret x as uint; }
219217
fn eq_int(&int a, &int b) -> bool { ret a == b; }
220-
auto hasher = hash_int;
221-
auto eqer = eq_int;
222-
ret mk_hashmap[int, V](hasher, eqer);
218+
ret mk_hashmap[int, V](hash_int, eq_int);
223219
}
224220

225221
fn new_uint_hash[V]() -> hashmap[uint, V] {
226222
fn hash_uint(&uint x) -> uint { ret x; }
227223
fn eq_uint(&uint a, &uint b) -> bool { ret a == b; }
228-
auto hasher = hash_uint;
229-
auto eqer = eq_uint;
230-
ret mk_hashmap[uint, V](hasher, eqer);
224+
ret mk_hashmap[uint, V](hash_uint, eq_uint);
231225
}
232226

233227
// Local Variables:

0 commit comments

Comments
 (0)