@@ -30,26 +30,26 @@ struct AnnihilateStats {
3030}
3131
3232unsafe fn each_live_alloc ( read_next_before : bool ,
33- f: |box : * mut raw:: Box < ( ) > , uniq : bool | -> bool )
33+ f: |alloc : * mut raw:: Box < ( ) > , uniq : bool | -> bool )
3434 -> bool {
3535 //! Walks the internal list of allocations
3636
3737 use managed;
3838 use rt:: local_heap;
3939
40- let mut box = local_heap:: live_allocs ( ) ;
41- while box != ptr:: mut_null ( ) {
42- let next_before = ( * box ) . next ;
43- let uniq = ( * box ) . ref_count == managed:: RC_MANAGED_UNIQUE ;
40+ let mut alloc = local_heap:: live_allocs ( ) ;
41+ while alloc != ptr:: mut_null ( ) {
42+ let next_before = ( * alloc ) . next ;
43+ let uniq = ( * alloc ) . ref_count == managed:: RC_MANAGED_UNIQUE ;
4444
45- if !f ( box as * mut raw:: Box < ( ) > , uniq) {
45+ if !f ( alloc as * mut raw:: Box < ( ) > , uniq) {
4646 return false ;
4747 }
4848
4949 if read_next_before {
50- box = next_before;
50+ alloc = next_before;
5151 } else {
52- box = ( * box ) . next ;
52+ alloc = ( * alloc ) . next ;
5353 }
5454 }
5555 return true ;
@@ -82,12 +82,12 @@ pub unsafe fn annihilate() {
8282 //
8383 // In this pass, nothing gets freed, so it does not matter whether
8484 // we read the next field before or after the callback.
85- each_live_alloc ( true , |box , uniq| {
85+ each_live_alloc ( true , |alloc , uniq| {
8686 stats. n_total_boxes += 1 ;
8787 if uniq {
8888 stats. n_unique_boxes += 1 ;
8989 } else {
90- ( * box ) . ref_count = managed:: RC_IMMORTAL ;
90+ ( * alloc ) . ref_count = managed:: RC_IMMORTAL ;
9191 }
9292 true
9393 } ) ;
@@ -97,10 +97,10 @@ pub unsafe fn annihilate() {
9797 // In this pass, unique-managed boxes may get freed, but not
9898 // managed boxes, so we must read the `next` field *after* the
9999 // callback, as the original value may have been freed.
100- each_live_alloc ( false , |box , uniq| {
100+ each_live_alloc ( false , |alloc , uniq| {
101101 if !uniq {
102- let tydesc = ( * box ) . type_desc ;
103- let data = & ( * box ) . data as * ( ) ;
102+ let tydesc = ( * alloc ) . type_desc ;
103+ let data = & ( * alloc ) . data as * ( ) ;
104104 ( ( * tydesc) . drop_glue ) ( data as * i8 ) ;
105105 }
106106 true
@@ -112,12 +112,12 @@ pub unsafe fn annihilate() {
112112 // unique-managed boxes, though I think that none of those are
113113 // left), so we must read the `next` field before, since it will
114114 // not be valid after.
115- each_live_alloc ( true , |box , uniq| {
115+ each_live_alloc ( true , |alloc , uniq| {
116116 if !uniq {
117117 stats. n_bytes_freed +=
118- ( * ( ( * box ) . type_desc ) ) . size
118+ ( * ( ( * alloc ) . type_desc ) ) . size
119119 + mem:: size_of :: < raw:: Box < ( ) > > ( ) ;
120- local_free ( box as * i8 ) ;
120+ local_free ( alloc as * i8 ) ;
121121 }
122122 true
123123 } ) ;
0 commit comments