about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-06-10 19:33:04 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-06-17 09:07:17 -0700
commitb4a2823cd6c6f1a560469587f902f3a1f49d3c79 (patch)
tree162e8021fd73ffc7dfe0798dc99097138343977a /src/liballoc
parentaa931e9c6f92557b99978f1cc562c99051190f79 (diff)
downloadrust-b4a2823cd6c6f1a560469587f902f3a1f49d3c79.tar.gz
rust-b4a2823cd6c6f1a560469587f902f3a1f49d3c79.zip
More test fixes and fallout of stability changes
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs2
-rw-r--r--src/liballoc/boxed.rs2
-rw-r--r--src/liballoc/rc.rs41
3 files changed, 21 insertions, 24 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index 282fca8d6c2..7bfeaec36d7 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -290,7 +290,7 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { Arc::strong_count(this)
              reason = "this function is unsafe with weak pointers")]
 pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
     // FIXME(#24880) potential race with upgraded weak pointers here
-    if strong_count(this) == 1 && weak_count(this) == 0 {
+    if Arc::strong_count(this) == 1 && Arc::weak_count(this) == 0 {
         // This unsafety is ok because we're guaranteed that the pointer
         // returned is the *only* pointer that will ever be returned to T. Our
         // reference count is guaranteed to be 1 at this point, and we required
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 0e6554702be..1a360ebc05c 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -267,7 +267,7 @@ impl Box<Any> {
         if self.is::<T>() {
             unsafe {
                 // Get the raw representation of the trait object
-                let raw = into_raw(self);
+                let raw = Box::into_raw(self);
                 let to: TraitObject =
                     mem::transmute::<*mut Any, TraitObject>(raw);
 
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index bdf02b23ff4..d5b6c86ef35 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -148,26 +148,24 @@
 //! ```
 
 #![stable(feature = "rust1", since = "1.0.0")]
+
+use core::prelude::*;
+
 #[cfg(not(test))]
-use boxed;
+use boxed::Box;
 #[cfg(test)]
-use std::boxed;
+use std::boxed::Box;
+
 use core::cell::Cell;
-use core::clone::Clone;
-use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
-use core::default::Default;
+use core::cmp::Ordering;
 use core::fmt;
 use core::hash::{Hasher, Hash};
 use core::intrinsics::{assume, drop_in_place};
-use core::marker::{self, Sized, Unsize};
+use core::marker::{self, Unsize};
 use core::mem::{self, min_align_of, size_of, min_align_of_val, size_of_val, forget};
 use core::nonzero::NonZero;
-use core::ops::{CoerceUnsized, Deref, Drop};
-use core::option::Option;
-use core::option::Option::{Some, None};
+use core::ops::{CoerceUnsized, Deref};
 use core::ptr;
-use core::result::Result;
-use core::result::Result::{Ok, Err};
 
 use heap::deallocate;
 
@@ -212,7 +210,7 @@ impl<T> Rc<T> {
                 // pointers, which ensures that the weak destructor never frees
                 // the allocation while the strong destructor is running, even
                 // if the weak pointer is stored inside the strong one.
-                _ptr: NonZero::new(boxed::into_raw(box RcBox {
+                _ptr: NonZero::new(Box::into_raw(box RcBox {
                     strong: Cell::new(1),
                     weak: Cell::new(1),
                     value: value
@@ -230,14 +228,14 @@ impl<T> Rc<T> {
     ///
     /// ```
     /// # #![feature(rc_unique)]
-    /// use std::rc::{self, Rc};
+    /// use std::rc::Rc;
     ///
     /// let x = Rc::new(3);
-    /// assert_eq!(rc::try_unwrap(x), Ok(3));
+    /// assert_eq!(Rc::try_unwrap(x), Ok(3));
     ///
     /// let x = Rc::new(4);
     /// let _y = x.clone();
-    /// assert_eq!(rc::try_unwrap(x), Err(Rc::new(4)));
+    /// assert_eq!(Rc::try_unwrap(x), Err(Rc::new(4)));
     /// ```
     #[inline]
     #[unstable(feature = "rc_unique")]
@@ -295,17 +293,16 @@ impl<T: ?Sized> Rc<T> {
     ///
     /// ```
     /// # #![feature(rc_unique)]
-    /// use std::rc;
     /// use std::rc::Rc;
     ///
     /// let five = Rc::new(5);
     ///
-    /// rc::is_unique(&five);
+    /// assert!(Rc::is_unique(&five));
     /// ```
     #[inline]
     #[unstable(feature = "rc_unique")]
     pub fn is_unique(rc: &Rc<T>) -> bool {
-        weak_count(rc) == 0 && strong_count(rc) == 1
+        Rc::weak_count(rc) == 0 && Rc::strong_count(rc) == 1
     }
 
     /// Returns a mutable reference to the contained value if the `Rc<T>` is
@@ -317,14 +314,14 @@ impl<T: ?Sized> Rc<T> {
     ///
     /// ```
     /// # #![feature(rc_unique)]
-    /// use std::rc::{self, Rc};
+    /// use std::rc::Rc;
     ///
     /// let mut x = Rc::new(3);
-    /// *rc::get_mut(&mut x).unwrap() = 4;
+    /// *Rc::get_mut(&mut x).unwrap() = 4;
     /// assert_eq!(*x, 4);
     ///
     /// let _y = x.clone();
-    /// assert!(rc::get_mut(&mut x).is_none());
+    /// assert!(Rc::get_mut(&mut x).is_none());
     /// ```
     #[inline]
     #[unstable(feature = "rc_unique")]
@@ -432,7 +429,7 @@ impl<T: Clone> Rc<T> {
     #[inline]
     #[unstable(feature = "rc_unique")]
     pub fn make_unique(&mut self) -> &mut T {
-        if !is_unique(self) {
+        if !Rc::is_unique(self) {
             *self = Rc::new((**self).clone())
         }
         // This unsafety is ok because we're guaranteed that the pointer