Skip to content

Commit

Permalink
Move Debug for NonNull impl closer to other trait impls
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed Jan 21, 2018
1 parent 3f55794 commit ad37e3f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/libcore/ptr.rs
Expand Up @@ -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")]
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ad37e3f

Please sign in to comment.