Skip to content

Commit 77aeb3f

Browse files
committed
---
yaml --- r: 82613 b: refs/heads/auto c: 411dce8 h: refs/heads/master i: 82611: b2a8392 v: v3
1 parent a54e15c commit 77aeb3f

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: eac429cc9e1e57ea9c91406dc149e7b1c79d86a0
16+
refs/heads/auto: 411dce85eadd4ef8abac9b538c8907ca20865bdd
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/trans/type_use.rs

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: DefId, n_tps: uint)
8181
// Conservatively assume full use for recursive loops
8282
ccx.type_use_cache.insert(fn_id, @vec::from_elem(n_tps, use_all));
8383

84-
let cx = Context {
84+
let mut cx = Context {
8585
ccx: ccx,
8686
uses: @mut vec::from_elem(n_tps, 0u)
8787
};
@@ -112,7 +112,7 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: DefId, n_tps: uint)
112112
ast_map::node_item(@ast::item { node: item_fn(_, _, _, _, ref body),
113113
_ }, _) |
114114
ast_map::node_method(@ast::method {body: ref body, _}, _, _) => {
115-
handle_body(&cx, body);
115+
handle_body(&mut cx, body);
116116
}
117117
ast_map::node_trait_method(*) => {
118118
// This will be a static trait method. For now, we just assume
@@ -414,39 +414,36 @@ pub fn mark_for_expr(cx: &Context, e: &Expr) {
414414
}
415415
}
416416

417-
struct TypeUseVisitor;
417+
impl Visitor<()> for Context {
418418

419-
impl<'self> Visitor<&'self Context> for TypeUseVisitor {
420-
421-
fn visit_expr<'a>(&mut self, e:@Expr, cx: &'a Context) {
422-
visit::walk_expr(self, e, cx);
423-
mark_for_expr(cx, e);
419+
fn visit_expr(&mut self, e:@Expr, _: ()) {
420+
visit::walk_expr(self, e, ());
421+
mark_for_expr(self, e);
424422
}
425423

426-
fn visit_local<'a>(&mut self, l:@Local, cx: &'a Context) {
427-
visit::walk_local(self, l, cx);
428-
node_type_needs(cx, use_repr, l.id);
424+
fn visit_local(&mut self, l:@Local, _:()) {
425+
visit::walk_local(self, l, ());
426+
node_type_needs(self, use_repr, l.id);
429427
}
430428

431-
fn visit_pat<'a>(&mut self, p:@Pat, cx: &'a Context) {
432-
visit::walk_pat(self, p, cx);
433-
node_type_needs(cx, use_repr, p.id);
429+
fn visit_pat(&mut self, p:@Pat, _: ()) {
430+
visit::walk_pat(self, p, ());
431+
node_type_needs(self, use_repr, p.id);
434432
}
435433

436-
fn visit_block<'a>(&mut self, b:&Block, cx: &'a Context) {
437-
visit::walk_block(self, b, cx);
434+
fn visit_block(&mut self, b:&Block, _: ()) {
435+
visit::walk_block(self, b, ());
438436
for e in b.expr.iter() {
439-
node_type_needs(cx, use_repr, e.id);
437+
node_type_needs(self, use_repr, e.id);
440438
}
441439
}
442440

443-
fn visit_item<'a>(&mut self, _:@item, _: &'a Context) {
441+
fn visit_item(&mut self, _:@item, _: ()) {
444442
// do nothing
445443
}
446444

447445
}
448446

449-
pub fn handle_body(cx: &Context, body: &Block) {
450-
let mut v = TypeUseVisitor;
451-
v.visit_block(body, cx);
447+
pub fn handle_body(cx: &mut Context, body: &Block) {
448+
cx.visit_block(body, ());
452449
}

0 commit comments

Comments
 (0)