Skip to content

Commit b0c4752

Browse files
committed
auto merge of #10055 : pcwalton/rust/arc-clone-inline, r=alexcrichton
r? @thestinger
2 parents 3f5b221 + b13415c commit b0c4752

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libextra/arc.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ pub struct Arc<T> { priv x: UnsafeArc<T> }
117117
*/
118118
impl<T:Freeze+Send> Arc<T> {
119119
/// Create an atomically reference counted wrapper.
120+
#[inline]
120121
pub fn new(data: T) -> Arc<T> {
121122
Arc { x: UnsafeArc::new(data) }
122123
}
123124

125+
#[inline]
124126
pub fn get<'a>(&'a self) -> &'a T {
125127
unsafe { &*self.x.get_immut() }
126128
}
@@ -148,6 +150,7 @@ impl<T:Freeze + Send> Clone for Arc<T> {
148150
* object. However, one of the `arc` objects can be sent to another task,
149151
* allowing them to share the underlying data.
150152
*/
153+
#[inline]
151154
fn clone(&self) -> Arc<T> {
152155
Arc { x: self.x.clone() }
153156
}
@@ -167,6 +170,7 @@ pub struct MutexArc<T> { priv x: UnsafeArc<MutexArcInner<T>> }
167170

168171
impl<T:Send> Clone for MutexArc<T> {
169172
/// Duplicate a mutex-protected Arc. See arc::clone for more details.
173+
#[inline]
170174
fn clone(&self) -> MutexArc<T> {
171175
// NB: Cloning the underlying mutex is not necessary. Its reference
172176
// count would be exactly the same as the shared state's.
@@ -349,6 +353,7 @@ pub struct RWArc<T> {
349353

350354
impl<T:Freeze + Send> Clone for RWArc<T> {
351355
/// Duplicate a rwlock-protected Arc. See arc::clone for more details.
356+
#[inline]
352357
fn clone(&self) -> RWArc<T> {
353358
RWArc { x: self.x.clone() }
354359
}

0 commit comments

Comments
 (0)