Skip to content

Commit b13415c

Browse files
committed
libextra: Make arc::get and arc::new inline too.
Should be a 2x improvement in a Servo test case.
1 parent 76287cc commit b13415c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libextra/arc.rs

Lines changed: 2 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
}

0 commit comments

Comments
 (0)