Address review comments
This commit is contained in:
parent
9697076b62
commit
7dd618fd23
2 changed files with 4 additions and 6 deletions
|
@ -924,19 +924,18 @@ impl<T> Weak<T> {
|
||||||
///
|
///
|
||||||
/// use std::sync::Arc;
|
/// use std::sync::Arc;
|
||||||
///
|
///
|
||||||
/// let five = Arc::new(5);
|
/// let empty: Weak<i64> = Weak::new();
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "downgraded_weak",
|
#[unstable(feature = "downgraded_weak",
|
||||||
reason = "recently added",
|
reason = "recently added",
|
||||||
issue = "30425")]
|
issue = "30425")]
|
||||||
pub fn new() -> Weak<T> {
|
pub fn new() -> Weak<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let x: Box<_> = box ArcInner {
|
Weak { _ptr: Shared::new(Box::into_raw(box ArcInner {
|
||||||
strong: atomic::AtomicUsize::new(0),
|
strong: atomic::AtomicUsize::new(0),
|
||||||
weak: atomic::AtomicUsize::new(1),
|
weak: atomic::AtomicUsize::new(1),
|
||||||
data: uninitialized(),
|
data: uninitialized(),
|
||||||
};
|
}))}
|
||||||
Weak { _ptr: Shared::new(Box::into_raw(x)) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -843,9 +843,8 @@ impl<T> Weak<T> {
|
||||||
///
|
///
|
||||||
/// use std::rc::Weak;
|
/// use std::rc::Weak;
|
||||||
///
|
///
|
||||||
/// let empty:Weak<i64> = Weak::new();
|
/// let empty: Weak<i64> = Weak::new();
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
#[unstable(feature = "downgraded_weak",
|
#[unstable(feature = "downgraded_weak",
|
||||||
reason = "recently added",
|
reason = "recently added",
|
||||||
issue="30425")]
|
issue="30425")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue