Skip to content

remove useless transmute_immut function #10756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ impl<T:Freeze + Send> RWArc<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
Expand Down
6 changes: 0 additions & 6 deletions src/libstd/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/unstable/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl<T:Send> Exclusive<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]
Expand Down