about summary refs log tree commit diff
path: root/src/libstd/util.rs
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-05-31 10:21:29 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-05-31 10:31:26 -0400
commit29aba8033afa4cab0261c82d5a4eded4b79af656 (patch)
tree863de7278108500a2dd1dd24d433128fbdfed19d /src/libstd/util.rs
parent030f471f26dbb6642c54a1e12ce63f7989db01ab (diff)
downloadrust-29aba8033afa4cab0261c82d5a4eded4b79af656.tar.gz
rust-29aba8033afa4cab0261c82d5a4eded4b79af656.zip
mv the raw pointer {swap,replace}_ptr to std::ptr
Diffstat (limited to 'src/libstd/util.rs')
-rw-r--r--src/libstd/util.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/libstd/util.rs b/src/libstd/util.rs
index 2b61356129e..21fbe2836cd 100644
--- a/src/libstd/util.rs
+++ b/src/libstd/util.rs
@@ -65,26 +65,6 @@ pub fn swap<T>(x: &mut T, y: &mut T) {
 }
 
 /**
- * Swap the values at two mutable locations of the same type, without
- * deinitialising or copying either one.
- */
-#[inline]
-pub unsafe fn swap_ptr<T>(x: *mut T, y: *mut T) {
-    // Give ourselves some scratch space to work with
-    let mut tmp: T = intrinsics::uninit();
-    let t: *mut T = &mut tmp;
-
-    // Perform the swap
-    ptr::copy_memory(t, x, 1);
-    ptr::copy_memory(x, y, 1);
-    ptr::copy_memory(y, t, 1);
-
-    // y and t now point to the same thing, but we need to completely forget `tmp`
-    // because it's no longer relevant.
-    cast::forget(tmp);
-}
-
-/**
  * Replace the value at a mutable location with a new one, returning the old
  * value, without deinitialising or copying either one.
  */
@@ -94,16 +74,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
     src
 }
 
-/**
- * Replace the value at a mutable location with a new one, returning the old
- * value, without deinitialising or copying either one.
- */
-#[inline(always)]
-pub unsafe fn replace_ptr<T>(dest: *mut T, mut src: T) -> T {
-    swap_ptr(dest, ptr::to_mut_unsafe_ptr(&mut src));
-    src
-}
-
 /// A non-copyable dummy type.
 pub struct NonCopyable {
     priv i: (),