@@ -124,9 +124,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
124124#[ unsafe_no_drop_flag]
125125#[ stable( feature = "rust1" , since = "1.0.0" ) ]
126126pub struct Arc < T : ?Sized > {
127- // FIXME #12808: strange name to try to avoid interfering with
128- // field accesses of the contained type via Deref
129- _ptr : Shared < ArcInner < T > > ,
127+ ptr : Shared < ArcInner < T > > ,
130128}
131129
132130#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -144,9 +142,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
144142#[ unsafe_no_drop_flag]
145143#[ stable( feature = "arc_weak" , since = "1.4.0" ) ]
146144pub struct Weak < T : ?Sized > {
147- // FIXME #12808: strange name to try to avoid interfering with
148- // field accesses of the contained type via Deref
149- _ptr : Shared < ArcInner < T > > ,
145+ ptr : Shared < ArcInner < T > > ,
150146}
151147
152148#[ stable( feature = "arc_weak" , since = "1.4.0" ) ]
@@ -198,7 +194,7 @@ impl<T> Arc<T> {
198194 weak : atomic:: AtomicUsize :: new ( 1 ) ,
199195 data : data,
200196 } ;
201- Arc { _ptr : unsafe { Shared :: new ( Box :: into_raw ( x) ) } }
197+ Arc { ptr : unsafe { Shared :: new ( Box :: into_raw ( x) ) } }
202198 }
203199
204200 /// Unwraps the contained value if the `Arc<T>` has exactly one strong reference.
@@ -230,11 +226,11 @@ impl<T> Arc<T> {
230226 atomic:: fence ( Acquire ) ;
231227
232228 unsafe {
233- let ptr = * this. _ptr ;
229+ let ptr = * this. ptr ;
234230 let elem = ptr:: read ( & ( * ptr) . data ) ;
235231
236232 // Make a weak pointer to clean up the implicit strong-weak reference
237- let _weak = Weak { _ptr : this. _ptr } ;
233+ let _weak = Weak { ptr : this. ptr } ;
238234 mem:: forget ( this) ;
239235
240236 Ok ( elem)
@@ -275,7 +271,7 @@ impl<T: ?Sized> Arc<T> {
275271 // synchronize with the write coming from `is_unique`, so that the
276272 // events prior to that write happen before this read.
277273 match this. inner ( ) . weak . compare_exchange_weak ( cur, cur + 1 , Acquire , Relaxed ) {
278- Ok ( _) => return Weak { _ptr : this. _ptr } ,
274+ Ok ( _) => return Weak { ptr : this. ptr } ,
279275 Err ( old) => cur = old,
280276 }
281277 }
@@ -304,13 +300,13 @@ impl<T: ?Sized> Arc<T> {
304300 // `ArcInner` structure itself is `Sync` because the inner data is
305301 // `Sync` as well, so we're ok loaning out an immutable pointer to these
306302 // contents.
307- unsafe { & * * self . _ptr }
303+ unsafe { & * * self . ptr }
308304 }
309305
310306 // Non-inlined part of `drop`.
311307 #[ inline( never) ]
312308 unsafe fn drop_slow ( & mut self ) {
313- let ptr = * self . _ptr ;
309+ let ptr = * self . ptr ;
314310
315311 // Destroy the data at this time, even though we may not free the box
316312 // allocation itself (there may still be weak pointers lying around).
@@ -368,7 +364,7 @@ impl<T: ?Sized> Clone for Arc<T> {
368364 }
369365 }
370366
371- Arc { _ptr : self . _ptr }
367+ Arc { ptr : self . ptr }
372368 }
373369}
374370
@@ -436,15 +432,15 @@ impl<T: Clone> Arc<T> {
436432
437433 // Materialize our own implicit weak pointer, so that it can clean
438434 // up the ArcInner as needed.
439- let weak = Weak { _ptr : this. _ptr } ;
435+ let weak = Weak { ptr : this. ptr } ;
440436
441437 // mark the data itself as already deallocated
442438 unsafe {
443439 // there is no data race in the implicit write caused by `read`
444440 // here (due to zeroing) because data is no longer accessed by
445441 // other threads (due to there being no more strong refs at this
446442 // point).
447- let mut swap = Arc :: new ( ptr:: read ( & ( * * weak. _ptr ) . data ) ) ;
443+ let mut swap = Arc :: new ( ptr:: read ( & ( * * weak. ptr ) . data ) ) ;
448444 mem:: swap ( this, & mut swap) ;
449445 mem:: forget ( swap) ;
450446 }
@@ -457,7 +453,7 @@ impl<T: Clone> Arc<T> {
457453 // As with `get_mut()`, the unsafety is ok because our reference was
458454 // either unique to begin with, or became one upon cloning the contents.
459455 unsafe {
460- let inner = & mut * * this. _ptr ;
456+ let inner = & mut * * this. ptr ;
461457 & mut inner. data
462458 }
463459 }
@@ -489,7 +485,7 @@ impl<T: ?Sized> Arc<T> {
489485 // the Arc itself to be `mut`, so we're returning the only possible
490486 // reference to the inner data.
491487 unsafe {
492- let inner = & mut * * this. _ptr ;
488+ let inner = & mut * * this. ptr ;
493489 Some ( & mut inner. data )
494490 }
495491 } else {
@@ -558,7 +554,7 @@ impl<T: ?Sized> Drop for Arc<T> {
558554 // This structure has #[unsafe_no_drop_flag], so this drop glue may run
559555 // more than once (but it is guaranteed to be zeroed after the first if
560556 // it's run more than once)
561- let thin = * self . _ptr as * const ( ) ;
557+ let thin = * self . ptr as * const ( ) ;
562558
563559 if thin as usize == mem:: POST_DROP_USIZE {
564560 return ;
@@ -639,7 +635,7 @@ impl<T: ?Sized> Weak<T> {
639635
640636 // Relaxed is valid for the same reason it is on Arc's Clone impl
641637 match inner. strong . compare_exchange_weak ( n, n + 1 , Relaxed , Relaxed ) {
642- Ok ( _) => return Some ( Arc { _ptr : self . _ptr } ) ,
638+ Ok ( _) => return Some ( Arc { ptr : self . ptr } ) ,
643639 Err ( old) => n = old,
644640 }
645641 }
@@ -648,7 +644,7 @@ impl<T: ?Sized> Weak<T> {
648644 #[ inline]
649645 fn inner ( & self ) -> & ArcInner < T > {
650646 // See comments above for why this is "safe"
651- unsafe { & * * self . _ptr }
647+ unsafe { & * * self . ptr }
652648 }
653649}
654650
@@ -682,7 +678,7 @@ impl<T: ?Sized> Clone for Weak<T> {
682678 }
683679 }
684680
685- return Weak { _ptr : self . _ptr } ;
681+ return Weak { ptr : self . ptr } ;
686682 }
687683}
688684
@@ -714,7 +710,7 @@ impl<T: ?Sized> Drop for Weak<T> {
714710 /// } // implicit drop
715711 /// ```
716712 fn drop ( & mut self ) {
717- let ptr = * self . _ptr ;
713+ let ptr = * self . ptr ;
718714 let thin = ptr as * const ( ) ;
719715
720716 // see comments above for why this check is here
@@ -886,7 +882,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
886882#[ stable( feature = "rust1" , since = "1.0.0" ) ]
887883impl < T : ?Sized > fmt:: Pointer for Arc < T > {
888884 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
889- fmt:: Pointer :: fmt ( & * self . _ptr , f)
885+ fmt:: Pointer :: fmt ( & * self . ptr , f)
890886 }
891887}
892888
@@ -931,7 +927,7 @@ impl<T> Weak<T> {
931927 issue = "30425" ) ]
932928 pub fn new ( ) -> Weak < T > {
933929 unsafe {
934- Weak { _ptr : Shared :: new ( Box :: into_raw ( box ArcInner {
930+ Weak { ptr : Shared :: new ( Box :: into_raw ( box ArcInner {
935931 strong : atomic:: AtomicUsize :: new ( 0 ) ,
936932 weak : atomic:: AtomicUsize :: new ( 1 ) ,
937933 data : uninitialized ( ) ,
0 commit comments