@@ -287,17 +287,15 @@ impl<T> Arc<T> {
287287 /// # Examples
288288 ///
289289 /// ```
290- /// #![feature(rc_raw)]
291- ///
292290 /// use std::sync::Arc;
293291 ///
294292 /// let x = Arc::new(10);
295293 /// let x_ptr = Arc::into_raw(x);
296294 /// assert_eq!(unsafe { *x_ptr }, 10);
297295 /// ```
298- #[ unstable ( feature = "rc_raw" , issue = "37197 " ) ]
299- pub fn into_raw ( this : Self ) -> * mut T {
300- let ptr = unsafe { & mut ( * * this. ptr ) . data as * mut _ } ;
296+ #[ stable ( feature = "rc_raw" , since = "1.17.0 " ) ]
297+ pub fn into_raw ( this : Self ) -> * const T {
298+ let ptr = unsafe { & ( * * this. ptr ) . data as * const _ } ;
301299 mem:: forget ( this) ;
302300 ptr
303301 }
@@ -315,8 +313,6 @@ impl<T> Arc<T> {
315313 /// # Examples
316314 ///
317315 /// ```
318- /// #![feature(rc_raw)]
319- ///
320316 /// use std::sync::Arc;
321317 ///
322318 /// let x = Arc::new(10);
@@ -332,11 +328,14 @@ impl<T> Arc<T> {
332328 ///
333329 /// // The memory was freed when `x` went out of scope above, so `x_ptr` is now dangling!
334330 /// ```
335- #[ unstable ( feature = "rc_raw" , issue = "37197 " ) ]
336- pub unsafe fn from_raw ( ptr : * mut T ) -> Self {
331+ #[ stable ( feature = "rc_raw" , since = "1.17.0 " ) ]
332+ pub unsafe fn from_raw ( ptr : * const T ) -> Self {
337333 // To find the corresponding pointer to the `ArcInner` we need to subtract the offset of the
338334 // `data` field from the pointer.
339- Arc { ptr : Shared :: new ( ( ptr as * mut u8 ) . offset ( -offset_of ! ( ArcInner <T >, data) ) as * mut _ ) }
335+ let ptr = ( ptr as * const u8 ) . offset ( -offset_of ! ( ArcInner <T >, data) ) ;
336+ Arc {
337+ ptr : Shared :: new ( ptr as * const _ ) ,
338+ }
340339 }
341340}
342341
@@ -448,7 +447,7 @@ impl<T: ?Sized> Arc<T> {
448447 // Non-inlined part of `drop`.
449448 #[ inline( never) ]
450449 unsafe fn drop_slow ( & mut self ) {
451- let ptr = * self . ptr ;
450+ let ptr = self . ptr . as_mut_ptr ( ) ;
452451
453452 // Destroy the data at this time, even though we may not free the box
454453 // allocation itself (there may still be weak pointers lying around).
@@ -461,17 +460,13 @@ impl<T: ?Sized> Arc<T> {
461460 }
462461
463462 #[ inline]
464- #[ unstable( feature = "ptr_eq" ,
465- reason = "newly added" ,
466- issue = "36497" ) ]
463+ #[ stable( feature = "ptr_eq" , since = "1.17.0" ) ]
467464 /// Returns true if the two `Arc`s point to the same value (not
468465 /// just values that compare as equal).
469466 ///
470467 /// # Examples
471468 ///
472469 /// ```
473- /// #![feature(ptr_eq)]
474- ///
475470 /// use std::sync::Arc;
476471 ///
477472 /// let five = Arc::new(5);
@@ -628,7 +623,7 @@ impl<T: Clone> Arc<T> {
628623 // As with `get_mut()`, the unsafety is ok because our reference was
629624 // either unique to begin with, or became one upon cloning the contents.
630625 unsafe {
631- let inner = & mut * * this. ptr ;
626+ let inner = & mut * this. ptr . as_mut_ptr ( ) ;
632627 & mut inner. data
633628 }
634629 }
@@ -671,7 +666,7 @@ impl<T: ?Sized> Arc<T> {
671666 // the Arc itself to be `mut`, so we're returning the only possible
672667 // reference to the inner data.
673668 unsafe {
674- let inner = & mut * * this. ptr ;
669+ let inner = & mut * this. ptr . as_mut_ptr ( ) ;
675670 Some ( & mut inner. data )
676671 }
677672 } else {
0 commit comments