Skip to content

Commit

Permalink
Remove unnecessary transmutes
Browse files Browse the repository at this point in the history
These were exposing a compiler crash on the latest nightly. See
rust-lang/rust#32377.
  • Loading branch information
euclio committed Mar 30, 2016
1 parent 611adf7 commit 2ae85b4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,11 @@ impl<P: Partial<R>, R: Send + 'static, E: Send + 'static> Progress<P, R, E> {
}

fn inner(&self) -> &ProgressInner<P, R, E> {
use std::mem;
unsafe { mem::transmute(self.inner.get()) }
unsafe { &*self.inner.get() }
}

fn inner_mut(&self) -> &mut ProgressInner<P, R, E> {
use std::mem;
unsafe { mem::transmute(self.inner.get()) }
unsafe { &mut *self.inner.get() }
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ impl<T: Send + 'static, U: Async, F> ops::Deref for Inner<T, U, F> {
type Target = Core<T, U, F>;

fn deref(&self) -> &Core<T, U, F> {
unsafe { mem::transmute(self.0.get()) }
unsafe { &*self.0.get() }
}
}

impl<T: Send + 'static, U: Async, F> ops::DerefMut for Inner<T, U, F> {
fn deref_mut(&mut self) -> &mut Core<T, U, F> {
unsafe { mem::transmute(self.0.get()) }
unsafe { &mut *self.0.get() }
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,11 @@ impl<V: Values<S, E>, S: Select<E>, E: Send + 'static> Selection<V, S, E> {
}

fn core(&self) -> &Core<V, S, E> {
use std::mem;
unsafe { mem::transmute(self.core.get()) }
unsafe { &*self.core.get() }
}

fn core_mut(&self) -> &mut Core<V, S, E> {
use std::mem;
unsafe { mem::transmute(self.core.get()) }
unsafe { &mut *self.core.get() }
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/sequence.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use {Async, AsyncError, Stream, Sender};
use std::{mem, ops};
use std::ops;
use std::cell::UnsafeCell;
use std::iter::IntoIterator;
use std::sync::Arc;
Expand Down Expand Up @@ -201,13 +201,13 @@ impl<A: Async> ops::Deref for Inner<A> {
type Target = Core<A>;

fn deref(&self) -> &Core<A> {
unsafe { mem::transmute(self.0.get()) }
unsafe { &*self.0.get() }
}
}

impl<A: Async> ops::DerefMut for Inner<A> {
fn deref_mut(&mut self) -> &mut Core<A> {
unsafe { mem::transmute(self.0.get()) }
unsafe { &mut *self.0.get() }
}
}

Expand Down

0 comments on commit 2ae85b4

Please sign in to comment.