Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed all the impl<T> to impl<T: Send> in rt::comm.rs and libstd::comm... #10168

Merged
merged 1 commit into from
Oct 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libstd/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl<T: Send> SendDeferred<T> for SharedChan<T> {
}
}

impl<T> Clone for SharedChan<T> {
impl<T: Send> Clone for SharedChan<T> {
fn clone(&self) -> SharedChan<T> {
let &SharedChan { x: ref c } = self;
SharedChan { x: c.clone() }
Expand Down Expand Up @@ -216,7 +216,7 @@ impl<T: Send> GenericPort<T> for SharedPort<T> {
}
}

impl<T> Clone for SharedPort<T> {
impl<T: Send> Clone for SharedPort<T> {
fn clone(&self) -> SharedPort<T> {
let &SharedPort { x: ref p } = self;
SharedPort { x: p.clone() }
Expand Down
42 changes: 21 additions & 21 deletions src/libstd/rt/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) {
}
}

impl<T> ChanOne<T> {
impl<T: Send> ChanOne<T> {
#[inline]
fn packet(&self) -> *mut Packet<T> {
unsafe {
Expand Down Expand Up @@ -181,7 +181,7 @@ impl<T> ChanOne<T> {
}
}

impl<T> PortOne<T> {
impl<T: Send> PortOne<T> {
fn packet(&self) -> *mut Packet<T> {
unsafe {
let p: *mut ~Packet<T> = cast::transmute(&self.void_packet);
Expand Down Expand Up @@ -218,7 +218,7 @@ impl<T> PortOne<T> {
}
}

impl<T> SelectInner for PortOne<T> {
impl<T: Send> SelectInner for PortOne<T> {
#[inline] #[cfg(not(test))]
fn optimistic_check(&mut self) -> bool {
unsafe { (*self.packet()).state.load(Acquire) == STATE_ONE }
Expand Down Expand Up @@ -319,9 +319,9 @@ impl<T> SelectInner for PortOne<T> {
}
}

impl<T> Select for PortOne<T> { }
impl<T: Send> Select for PortOne<T> { }

impl<T> SelectPortInner<T> for PortOne<T> {
impl<T: Send> SelectPortInner<T> for PortOne<T> {
fn recv_ready(mut self) -> Option<T> {
let packet = self.packet();

Expand Down Expand Up @@ -352,9 +352,9 @@ impl<T> SelectPortInner<T> for PortOne<T> {
}
}

impl<T> SelectPort<T> for PortOne<T> { }
impl<T: Send> SelectPort<T> for PortOne<T> { }

impl<T> Peekable<T> for PortOne<T> {
impl<T: Send> Peekable<T> for PortOne<T> {
fn peek(&self) -> bool {
unsafe {
let packet: *mut Packet<T> = self.packet();
Expand All @@ -369,7 +369,7 @@ impl<T> Peekable<T> for PortOne<T> {
}

#[unsafe_destructor]
impl<T> Drop for ChanOne<T> {
impl<T: Send> Drop for ChanOne<T> {
fn drop(&mut self) {
if self.suppress_finalize { return }

Expand All @@ -396,7 +396,7 @@ impl<T> Drop for ChanOne<T> {
}

#[unsafe_destructor]
impl<T> Drop for PortOne<T> {
impl<T: Send> Drop for PortOne<T> {
fn drop(&mut self) {
if self.suppress_finalize { return }

Expand Down Expand Up @@ -484,7 +484,7 @@ impl<T: Send> SendDeferred<T> for Chan<T> {
}
}

impl<T> GenericPort<T> for Port<T> {
impl<T: Send> GenericPort<T> for Port<T> {
fn recv(&self) -> T {
match self.try_recv() {
Some(val) => val,
Expand All @@ -507,7 +507,7 @@ impl<T> GenericPort<T> for Port<T> {
}
}

impl<T> Peekable<T> for Port<T> {
impl<T: Send> Peekable<T> for Port<T> {
fn peek(&self) -> bool {
self.next.with_mut_ref(|p| p.peek())
}
Expand All @@ -517,7 +517,7 @@ impl<T> Peekable<T> for Port<T> {
// of them, but a &Port<T> should also be selectable so you can select2 on it
// alongside a PortOne<U> without passing the port by value in recv_ready.

impl<'self, T> SelectInner for &'self Port<T> {
impl<'self, T: Send> SelectInner for &'self Port<T> {
#[inline]
fn optimistic_check(&mut self) -> bool {
do self.next.with_mut_ref |pone| { pone.optimistic_check() }
Expand All @@ -535,9 +535,9 @@ impl<'self, T> SelectInner for &'self Port<T> {
}
}

impl<'self, T> Select for &'self Port<T> { }
impl<'self, T: Send> Select for &'self Port<T> { }

impl<T> SelectInner for Port<T> {
impl<T: Send> SelectInner for Port<T> {
#[inline]
fn optimistic_check(&mut self) -> bool {
(&*self).optimistic_check()
Expand All @@ -554,9 +554,9 @@ impl<T> SelectInner for Port<T> {
}
}

impl<T> Select for Port<T> { }
impl<T: Send> Select for Port<T> { }

impl<'self, T> SelectPortInner<T> for &'self Port<T> {
impl<'self, T: Send> SelectPortInner<T> for &'self Port<T> {
fn recv_ready(self) -> Option<T> {
match self.next.take().recv_ready() {
Some(StreamPayload { val, next }) => {
Expand All @@ -568,14 +568,14 @@ impl<'self, T> SelectPortInner<T> for &'self Port<T> {
}
}

impl<'self, T> SelectPort<T> for &'self Port<T> { }
impl<'self, T: Send> SelectPort<T> for &'self Port<T> { }

pub struct SharedChan<T> {
// Just like Chan, but a shared AtomicOption instead of Cell
priv next: UnsafeArc<AtomicOption<StreamChanOne<T>>>
}

impl<T> SharedChan<T> {
impl<T: Send> SharedChan<T> {
pub fn new(chan: Chan<T>) -> SharedChan<T> {
let next = chan.next.take();
let next = AtomicOption::new(~next);
Expand Down Expand Up @@ -615,7 +615,7 @@ impl<T: Send> SendDeferred<T> for SharedChan<T> {
}
}

impl<T> Clone for SharedChan<T> {
impl<T: Send> Clone for SharedChan<T> {
fn clone(&self) -> SharedChan<T> {
SharedChan {
next: self.next.clone()
Expand All @@ -628,7 +628,7 @@ pub struct SharedPort<T> {
priv next_link: UnsafeArc<AtomicOption<PortOne<StreamPortOne<T>>>>
}

impl<T> SharedPort<T> {
impl<T: Send> SharedPort<T> {
pub fn new(port: Port<T>) -> SharedPort<T> {
// Put the data port into a new link pipe
let next_data_port = port.next.take();
Expand Down Expand Up @@ -670,7 +670,7 @@ impl<T: Send> GenericPort<T> for SharedPort<T> {
}
}

impl<T> Clone for SharedPort<T> {
impl<T: Send> Clone for SharedPort<T> {
fn clone(&self) -> SharedPort<T> {
SharedPort {
next_link: self.next_link.clone()
Expand Down