Skip to content

Commit 0455e4c

Browse files
committed
auto merge of #10756 : thestinger/rust/transmute, r=alexcrichton
2 parents 9ac4878 + b4a1733 commit 0455e4c

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

src/libextra/arc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ impl<T:Freeze + Send> RWArc<T> {
485485
// Whatever region the input reference had, it will be safe to use
486486
// the same region for the output reference. (The only 'unsafe' part
487487
// of this cast is removing the mutability.)
488-
let new_data = cast::transmute_immut(data);
488+
let new_data = data;
489489
// Downgrade ensured the token belonged to us. Just a sanity check.
490490
assert!(borrow::ref_eq(&(*state).data, new_data));
491491
// Produce new token

src/libstd/cast.rs

-6
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ pub unsafe fn transmute<L, G>(thing: L) -> G {
6262
#[inline]
6363
pub unsafe fn transmute_mut<'a,T>(ptr: &'a T) -> &'a mut T { transmute(ptr) }
6464

65-
/// Coerce a mutable reference to be immutable.
66-
#[inline]
67-
pub unsafe fn transmute_immut<'a,T>(ptr: &'a mut T) -> &'a T {
68-
transmute(ptr)
69-
}
70-
7165
/// Coerce a borrowed pointer to have an arbitrary associated region.
7266
#[inline]
7367
pub unsafe fn transmute_region<'a,'b,T>(ptr: &'a T) -> &'b T {

src/libstd/unstable/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl<T:Send> Exclusive<T> {
420420

421421
#[inline]
422422
pub unsafe fn with_imm<U>(&self, f: |x: &T| -> U) -> U {
423-
self.with(|x| f(cast::transmute_immut(x)))
423+
self.with(|x| f(x))
424424
}
425425

426426
#[inline]

0 commit comments

Comments
 (0)