1
Fork 0

auto merge of #18367 : pcwalton/rust/inline-atomic-constructors, r=thestinger

Servo really wants this.

r? @brson
This commit is contained in:
bors 2014-10-30 11:12:04 +00:00
commit ad4557ce76

View file

@ -94,6 +94,7 @@ const UINT_TRUE: uint = -1;
#[stable] #[stable]
impl AtomicBool { impl AtomicBool {
/// Create a new `AtomicBool` /// Create a new `AtomicBool`
#[inline]
pub fn new(v: bool) -> AtomicBool { pub fn new(v: bool) -> AtomicBool {
let val = if v { UINT_TRUE } else { 0 }; let val = if v { UINT_TRUE } else { 0 };
AtomicBool { v: UnsafeCell::new(val), nocopy: marker::NoCopy } AtomicBool { v: UnsafeCell::new(val), nocopy: marker::NoCopy }
@ -305,6 +306,7 @@ impl AtomicBool {
#[stable] #[stable]
impl AtomicInt { impl AtomicInt {
/// Create a new `AtomicInt` /// Create a new `AtomicInt`
#[inline]
pub fn new(v: int) -> AtomicInt { pub fn new(v: int) -> AtomicInt {
AtomicInt {v: UnsafeCell::new(v), nocopy: marker::NoCopy} AtomicInt {v: UnsafeCell::new(v), nocopy: marker::NoCopy}
} }
@ -426,6 +428,7 @@ impl AtomicInt {
#[stable] #[stable]
impl AtomicUint { impl AtomicUint {
/// Create a new `AtomicUint` /// Create a new `AtomicUint`
#[inline]
pub fn new(v: uint) -> AtomicUint { pub fn new(v: uint) -> AtomicUint {
AtomicUint { v: UnsafeCell::new(v), nocopy: marker::NoCopy } AtomicUint { v: UnsafeCell::new(v), nocopy: marker::NoCopy }
} }
@ -547,6 +550,7 @@ impl AtomicUint {
#[stable] #[stable]
impl<T> AtomicPtr<T> { impl<T> AtomicPtr<T> {
/// Create a new `AtomicPtr` /// Create a new `AtomicPtr`
#[inline]
pub fn new(p: *mut T) -> AtomicPtr<T> { pub fn new(p: *mut T) -> AtomicPtr<T> {
AtomicPtr { p: UnsafeCell::new(p as uint), nocopy: marker::NoCopy } AtomicPtr { p: UnsafeCell::new(p as uint), nocopy: marker::NoCopy }
} }