@@ -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, 0 u)
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