@@ -356,9 +356,9 @@ impl<T: ?Sized> Arc<T> {
356356 /// ```
357357 /// use std::sync::Arc;
358358 ///
359- /// let x = Arc::new(10 );
359+ /// let x = Arc::new("hello".to_owned() );
360360 /// let x_ptr = Arc::into_raw(x);
361- /// assert_eq!(unsafe { *x_ptr }, 10 );
361+ /// assert_eq!(unsafe { & *x_ptr }, "hello" );
362362 /// ```
363363 #[ stable( feature = "rc_raw" , since = "1.17.0" ) ]
364364 pub fn into_raw ( this : Self ) -> * const T {
@@ -382,13 +382,13 @@ impl<T: ?Sized> Arc<T> {
382382 /// ```
383383 /// use std::sync::Arc;
384384 ///
385- /// let x = Arc::new(10 );
385+ /// let x = Arc::new("hello".to_owned() );
386386 /// let x_ptr = Arc::into_raw(x);
387387 ///
388388 /// unsafe {
389389 /// // Convert back to an `Arc` to prevent leak.
390390 /// let x = Arc::from_raw(x_ptr);
391- /// assert_eq!(*x, 10 );
391+ /// assert_eq!(& *x, "hello" );
392392 ///
393393 /// // Further calls to `Arc::from_raw(x_ptr)` would be memory unsafe.
394394 /// }
@@ -418,10 +418,10 @@ impl<T: ?Sized> Arc<T> {
418418 ///
419419 /// use std::sync::Arc;
420420 ///
421- /// let x = Arc::new(10 );
421+ /// let x = Arc::new("hello".to_owned() );
422422 /// let ptr = Arc::into_raw_non_null(x);
423- /// let deref = unsafe { * ptr.as_ref() };
424- /// assert_eq!(deref, 10 );
423+ /// let deref = unsafe { ptr.as_ref() };
424+ /// assert_eq!(deref, "hello" );
425425 /// ```
426426 #[ unstable( feature = "rc_into_raw_non_null" , issue = "47336" ) ]
427427 #[ inline]
@@ -1083,17 +1083,17 @@ impl<T> Weak<T> {
10831083 /// use std::sync::{Arc, Weak};
10841084 /// use std::ptr;
10851085 ///
1086- /// let strong = Arc::new(42 );
1086+ /// let strong = Arc::new("hello".to_owned() );
10871087 /// let weak = Arc::downgrade(&strong);
10881088 /// // Both point to the same object
10891089 /// assert!(ptr::eq(&*strong, Weak::as_raw(&weak)));
10901090 /// // The strong here keeps it alive, so we can still access the object.
1091- /// assert_eq!(42 , unsafe { *Weak::as_raw(&weak) });
1091+ /// assert_eq!("hello" , unsafe { & *Weak::as_raw(&weak) });
10921092 ///
10931093 /// drop(strong);
10941094 /// // But not any more. We can do Weak::as_raw(&weak), but accessing the pointer would lead to
10951095 /// // undefined behaviour.
1096- /// // assert_eq!(42 , unsafe { *Weak::as_raw(&weak) });
1096+ /// // assert_eq!("hello" , unsafe { & *Weak::as_raw(&weak) });
10971097 /// ```
10981098 ///
10991099 /// [`null`]: ../../std/ptr/fn.null.html
@@ -1128,12 +1128,12 @@ impl<T> Weak<T> {
11281128 ///
11291129 /// use std::sync::{Arc, Weak};
11301130 ///
1131- /// let strong = Arc::new(42 );
1131+ /// let strong = Arc::new("hello".to_owned() );
11321132 /// let weak = Arc::downgrade(&strong);
11331133 /// let raw = Weak::into_raw(weak);
11341134 ///
11351135 /// assert_eq!(1, Arc::weak_count(&strong));
1136- /// assert_eq!(42 , unsafe { *raw });
1136+ /// assert_eq!("hello" , unsafe { & *raw });
11371137 ///
11381138 /// drop(unsafe { Weak::from_raw(raw) });
11391139 /// assert_eq!(0, Arc::weak_count(&strong));
@@ -1170,14 +1170,14 @@ impl<T> Weak<T> {
11701170 ///
11711171 /// use std::sync::{Arc, Weak};
11721172 ///
1173- /// let strong = Arc::new(42 );
1173+ /// let strong = Arc::new("hello".to_owned() );
11741174 ///
11751175 /// let raw_1 = Weak::into_raw(Arc::downgrade(&strong));
11761176 /// let raw_2 = Weak::into_raw(Arc::downgrade(&strong));
11771177 ///
11781178 /// assert_eq!(2, Arc::weak_count(&strong));
11791179 ///
1180- /// assert_eq!(42, *Weak::upgrade(&unsafe { Weak::from_raw(raw_1) }).unwrap());
1180+ /// assert_eq!("hello", & *Weak::upgrade(&unsafe { Weak::from_raw(raw_1) }).unwrap());
11811181 /// assert_eq!(1, Arc::weak_count(&strong));
11821182 ///
11831183 /// drop(strong);
0 commit comments