about summary refs log tree commit diff
path: root/src/libcollections/priority_queue.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2014-05-29 17:40:18 -0700
committerBrian Anderson <banderson@mozilla.com>2014-06-04 18:21:21 -0700
commit9b228f8424d207fc412bf549d3d9dc8262415f27 (patch)
tree169d7f666b23207484a732ff533715b2ca16535e /src/libcollections/priority_queue.rs
parentaa09561bb606bb622136ac9ad3702ab1179db5b2 (diff)
downloadrust-9b228f8424d207fc412bf549d3d9dc8262415f27.tar.gz
rust-9b228f8424d207fc412bf549d3d9dc8262415f27.zip
core: Apply stability attributes to ptr mod
* null and mut_null are unstable. Their names may change if the unsafe
  pointer types change.
* copy_memory and copy_overlapping_memory are unstable. We think they
  aren't going to change.
* set_memory and zero_memory are experimental. Both the names and
  the semantics are under question.
* swap and replace are unstable and probably won't change.
* read is unstable, probably won't change
* read_and_zero is experimental. It's necessity is in doubt.
* mem::overwrite is now called ptr::write to match read and is
  unstable. mem::overwrite is now deprecated
* array_each, array_each_with_len, buf_len, and position are
  all deprecated because they use old style iteration and their
  utility is generally under question.
Diffstat (limited to 'src/libcollections/priority_queue.rs')
-rw-r--r--src/libcollections/priority_queue.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs
index 3c1337a0382..d73c07ee17d 100644
--- a/src/libcollections/priority_queue.rs
+++ b/src/libcollections/priority_queue.rs
@@ -13,7 +13,8 @@
 #![allow(missing_doc)]
 
 use std::clone::Clone;
-use std::mem::{overwrite, zeroed, replace, swap};
+use std::mem::{zeroed, replace, swap};
+use std::ptr;
 use std::slice;
 
 /// A priority queue implemented with a binary heap
@@ -163,13 +164,13 @@ impl<T: Ord> PriorityQueue<T> {
                 let parent = (pos - 1) >> 1;
                 if new > *self.data.get(parent) {
                     let x = replace(self.data.get_mut(parent), zeroed());
-                    overwrite(self.data.get_mut(pos), x);
+                    ptr::write(self.data.get_mut(pos), x);
                     pos = parent;
                     continue
                 }
                 break
             }
-            overwrite(self.data.get_mut(pos), new);
+            ptr::write(self.data.get_mut(pos), new);
         }
     }
 
@@ -185,12 +186,12 @@ impl<T: Ord> PriorityQueue<T> {
                     child = right;
                 }
                 let x = replace(self.data.get_mut(child), zeroed());
-                overwrite(self.data.get_mut(pos), x);
+                ptr::write(self.data.get_mut(pos), x);
                 pos = child;
                 child = 2 * pos + 1;
             }
 
-            overwrite(self.data.get_mut(pos), new);
+            ptr::write(self.data.get_mut(pos), new);
             self.siftup(start, pos);
         }
     }