// 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
#[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 {
#[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]