]> git.lizzy.rs Git - rust.git/commitdiff
Move Debug for NonNull impl closer to other trait impls
authorSimon Sapin <simon.sapin@exyr.org>
Sun, 21 Jan 2018 08:48:58 +0000 (09:48 +0100)
committerSimon Sapin <simon.sapin@exyr.org>
Sun, 21 Jan 2018 08:48:58 +0000 (09:48 +0100)
src/libcore/ptr.rs

index 607e4a1a9fa106b93bd70866dda208751ea7c6d2..c3b7c4f5d22471a9e172522a7cc06c12e4e25250 100644 (file)
@@ -2487,13 +2487,6 @@ pub struct NonNull<T: ?Sized> {
     pointer: NonZero<*const T>,
 }
 
-#[stable(feature = "nonnull", since = "1.25.0")]
-impl<T: ?Sized> fmt::Debug for NonNull<T> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        fmt::Pointer::fmt(&self.as_ptr(), f)
-    }
-}
-
 /// `NonNull` pointers are not `Send` because the data they reference may be aliased.
 // NB: This impl is unnecessary, but should provide better error messages.
 #[stable(feature = "nonnull", since = "1.25.0")]
@@ -2575,6 +2568,13 @@ impl<T: ?Sized> Copy for NonNull<T> { }
 #[stable(feature = "nonnull", since = "1.25.0")]
 impl<T: ?Sized, U: ?Sized> CoerceUnsized<NonNull<U>> for NonNull<T> where T: Unsize<U> { }
 
+#[stable(feature = "nonnull", since = "1.25.0")]
+impl<T: ?Sized> fmt::Debug for NonNull<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Pointer::fmt(&self.as_ptr(), f)
+    }
+}
+
 #[stable(feature = "nonnull", since = "1.25.0")]
 impl<T: ?Sized> fmt::Pointer for NonNull<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {