Undo changes to core::ptr

This commit is contained in:
Paul Liétar 2017-10-05 02:12:59 +02:00
parent 77f7e85d7f
commit 398947d766

View File

@ -485,9 +485,8 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_null(self) -> bool {
// cast to () pointer, as T may not be sized
self as *const () == null()
pub fn is_null(self) -> bool where T: Sized {
self == null()
}
/// Returns `None` if the pointer is null, or else returns a reference to
@ -518,7 +517,7 @@ impl<T: ?Sized> *const T {
/// ```
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
#[inline]
pub unsafe fn as_ref<'a>(self) -> Option<&'a T> {
pub unsafe fn as_ref<'a>(self) -> Option<&'a T> where T: Sized {
if self.is_null() {
None
} else {
@ -1117,9 +1116,8 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_null(self) -> bool {
// cast to () pointer, as T may not be sized
self as *mut () == null_mut()
pub fn is_null(self) -> bool where T: Sized {
self == null_mut()
}
/// Returns `None` if the pointer is null, or else returns a reference to
@ -1150,7 +1148,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
#[inline]
pub unsafe fn as_ref<'a>(self) -> Option<&'a T> {
pub unsafe fn as_ref<'a>(self) -> Option<&'a T> where T: Sized {
if self.is_null() {
None
} else {
@ -1274,7 +1272,7 @@ impl<T: ?Sized> *mut T {
/// ```
#[stable(feature = "ptr_as_ref", since = "1.9.0")]
#[inline]
pub unsafe fn as_mut<'a>(self) -> Option<&'a mut T> {
pub unsafe fn as_mut<'a>(self) -> Option<&'a mut T> where T: Sized {
if self.is_null() {
None
} else {