about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-06-29 01:06:20 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-07-22 20:38:39 +0200
commitddaf9b24f035f11a5ce53b39352d3e76093b766e (patch)
tree97aa7652e96028f7e03cc098ae8322a96b7b2597
parent0a08ad0443631ca86e61526916fb4ee61fe1abce (diff)
downloadrust-ddaf9b24f035f11a5ce53b39352d3e76093b766e.tar.gz
rust-ddaf9b24f035f11a5ce53b39352d3e76093b766e.zip
Rename {NonZero,Shared,Unique}::new_checked to new
-rw-r--r--src/libcore/nonzero.rs2
-rw-r--r--src/libcore/ptr.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs
index 6acdcad8763..65ebb8c5ae3 100644
--- a/src/libcore/nonzero.rs
+++ b/src/libcore/nonzero.rs
@@ -75,7 +75,7 @@ impl<T: Zeroable> NonZero<T> {
 
     /// Creates an instance of NonZero with the provided value.
     #[inline]
-    pub fn new_checked(inner: T) -> Option<Self> {
+    pub fn new(inner: T) -> Option<Self> {
         if inner.is_zero() {
             None
         } else {
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 5ece63e23b1..633cd20bbf2 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -1115,8 +1115,8 @@ impl<T: ?Sized> Unique<T> {
     }
 
     /// Creates a new `Unique` if `ptr` is non-null.
-    pub fn new_checked(ptr: *mut T) -> Option<Self> {
-        NonZero::new_checked(ptr as *const T).map(|nz| Unique { pointer: nz, _marker: PhantomData })
+    pub fn new(ptr: *mut T) -> Option<Self> {
+        NonZero::new(ptr as *const T).map(|nz| Unique { pointer: nz, _marker: PhantomData })
     }
 
     /// Acquires the underlying `*mut` pointer.
@@ -1234,8 +1234,8 @@ impl<T: ?Sized> Shared<T> {
     }
 
     /// Creates a new `Shared` if `ptr` is non-null.
-    pub fn new_checked(ptr: *mut T) -> Option<Self> {
-        NonZero::new_checked(ptr as *const T).map(|nz| Shared { pointer: nz, _marker: PhantomData })
+    pub fn new(ptr: *mut T) -> Option<Self> {
+        NonZero::new(ptr as *const T).map(|nz| Shared { pointer: nz, _marker: PhantomData })
     }
 
     /// Acquires the underlying `*mut` pointer.