@@ -81,7 +81,7 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: DefId, n_tps: uint)
81
81
// Conservatively assume full use for recursive loops
82
82
ccx. type_use_cache . insert ( fn_id, @vec:: from_elem ( n_tps, use_all) ) ;
83
83
84
- let cx = Context {
84
+ let mut cx = Context {
85
85
ccx : ccx,
86
86
uses : @mut vec:: from_elem ( n_tps, 0 u)
87
87
} ;
@@ -112,7 +112,7 @@ pub fn type_uses_for(ccx: @mut CrateContext, fn_id: DefId, n_tps: uint)
112
112
ast_map:: node_item( @ast:: item { node : item_fn( _, _, _, _, ref body) ,
113
113
_ } , _) |
114
114
ast_map:: node_method( @ast:: method { body : ref body, _} , _, _) => {
115
- handle_body ( & cx, body) ;
115
+ handle_body ( & mut cx, body) ;
116
116
}
117
117
ast_map:: node_trait_method( * ) => {
118
118
// 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) {
414
414
}
415
415
}
416
416
417
- struct TypeUseVisitor ;
417
+ impl Visitor < ( ) > for Context {
418
418
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) ;
424
422
}
425
423
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 ) ;
429
427
}
430
428
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 ) ;
434
432
}
435
433
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, ( ) ) ;
438
436
for e in b. expr . iter ( ) {
439
- node_type_needs ( cx , use_repr, e. id ) ;
437
+ node_type_needs ( self , use_repr, e. id ) ;
440
438
}
441
439
}
442
440
443
- fn visit_item < ' a > ( & mut self , _: @item, _: & ' a Context ) {
441
+ fn visit_item ( & mut self , _: @item, _: ( ) ) {
444
442
// do nothing
445
443
}
446
444
447
445
}
448
446
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, ( ) ) ;
452
449
}
0 commit comments