]> git.lizzy.rs Git - rust.git/commitdiff
remove useless `transmute_immut` function
authorDaniel Micay <danielmicay@gmail.com>
Sun, 1 Dec 2013 15:18:47 +0000 (10:18 -0500)
committerDaniel Micay <danielmicay@gmail.com>
Sun, 1 Dec 2013 15:18:47 +0000 (10:18 -0500)
src/libextra/arc.rs
src/libstd/cast.rs
src/libstd/unstable/sync.rs

index 770aa6432cfa1cced9a3052c16eb5ed9a87b6dbc..d4fa7252f77f0a290d440025270c4befb81e5271 100644 (file)
@@ -485,7 +485,7 @@ pub fn downgrade<'a>(&self, token: RWWriteMode<'a, T>)
             // 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
index bc4579c00a00c85ccc0a8ad463e44e1afa8df146..08276082ebba52eab29764d88a332d69d7c826b0 100644 (file)
@@ -62,12 +62,6 @@ pub unsafe fn transmute<L, G>(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 {
index 02b35992f8c40cbeea89e68fbd35a68ec744f1fe..420c1d69d1c5dd3ff23367e27262f495cc5666d7 100644 (file)
@@ -420,7 +420,7 @@ pub unsafe fn with<U>(&self, f: |x: &mut T| -> U) -> U {
 
     #[inline]
     pub unsafe fn with_imm<U>(&self, f: |x: &T| -> U) -> U {
-        self.with(|x| f(cast::transmute_immut(x)))
+        self.with(|x| f(x))
     }
 
     #[inline]