From b4a1733fd23530e10545ea999557fa3b5e45c25b Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 1 Dec 2013 10:18:47 -0500 Subject: [PATCH] remove useless `transmute_immut` function --- src/libextra/arc.rs | 2 +- src/libstd/cast.rs | 6 ------ src/libstd/unstable/sync.rs | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 770aa6432cfa1..d4fa7252f77f0 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -485,7 +485,7 @@ impl RWArc { // Whatever region the input reference had, it will be safe to use // the same region for the output reference. (The only 'unsafe' part // of this cast is removing the mutability.) - let new_data = cast::transmute_immut(data); + let new_data = data; // Downgrade ensured the token belonged to us. Just a sanity check. assert!(borrow::ref_eq(&(*state).data, new_data)); // Produce new token diff --git a/src/libstd/cast.rs b/src/libstd/cast.rs index bc4579c00a00c..08276082ebba5 100644 --- a/src/libstd/cast.rs +++ b/src/libstd/cast.rs @@ -62,12 +62,6 @@ pub unsafe fn transmute(thing: L) -> G { #[inline] pub unsafe fn transmute_mut<'a,T>(ptr: &'a T) -> &'a mut T { transmute(ptr) } -/// Coerce a mutable reference to be immutable. -#[inline] -pub unsafe fn transmute_immut<'a,T>(ptr: &'a mut T) -> &'a T { - transmute(ptr) -} - /// Coerce a borrowed pointer to have an arbitrary associated region. #[inline] pub unsafe fn transmute_region<'a,'b,T>(ptr: &'a T) -> &'b T { diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs index 02b35992f8c40..420c1d69d1c5d 100644 --- a/src/libstd/unstable/sync.rs +++ b/src/libstd/unstable/sync.rs @@ -420,7 +420,7 @@ impl Exclusive { #[inline] pub unsafe fn with_imm(&self, f: |x: &T| -> U) -> U { - self.with(|x| f(cast::transmute_immut(x))) + self.with(|x| f(x)) } #[inline]