about summary refs log tree commit diff
path: root/src/libsyntax/ptr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-24 13:47:22 -0700
committerbors <bors@rust-lang.org>2016-04-24 13:47:22 -0700
commit19304837c86cc406ee042c99e12fa34debae4e8a (patch)
tree180cf9b6c1b7e850bf19c7101e112729ad381b6e /src/libsyntax/ptr.rs
parent91aea5cf87953788477ccaa3a37c3f2c855e7a0a (diff)
parenta31658de51444d1b5193ac203a1bd7ace5621f93 (diff)
downloadrust-19304837c86cc406ee042c99e12fa34debae4e8a.tar.gz
rust-19304837c86cc406ee042c99e12fa34debae4e8a.zip
Auto merge of #33179 - Manishearth:breaking-batch, r=Manishearth
Batch up breaking libsyntax changes

Contains:

 - #33125
 - #33041
 - #33157

cc https://github.com/rust-lang/rust/issues/31645
Diffstat (limited to 'src/libsyntax/ptr.rs')
-rw-r--r--src/libsyntax/ptr.rs42
1 files changed, 6 insertions, 36 deletions
diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs
index fda9741d35c..9d04cb75daa 100644
--- a/src/libsyntax/ptr.rs
+++ b/src/libsyntax/ptr.rs
@@ -83,10 +83,10 @@ impl<T: 'static> P<T> {
     }
 }
 
-impl<T> Deref for P<T> {
+impl<T: ?Sized> Deref for P<T> {
     type Target = T;
 
-    fn deref<'a>(&'a self) -> &'a T {
+    fn deref(&self) -> &T {
         &self.ptr
     }
 }
@@ -97,11 +97,12 @@ impl<T: 'static + Clone> Clone for P<T> {
     }
 }
 
-impl<T: Debug> Debug for P<T> {
+impl<T: ?Sized + Debug> Debug for P<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        Debug::fmt(&**self, f)
+        Debug::fmt(&self.ptr, f)
     }
 }
+
 impl<T: Display> Display for P<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         Display::fmt(&**self, f)
@@ -126,19 +127,8 @@ impl<T: Encodable> Encodable for P<T> {
     }
 }
 
-
-impl<T:fmt::Debug> fmt::Debug for P<[T]> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        self.ptr.fmt(fmt)
-    }
-}
-
 impl<T> P<[T]> {
     pub fn new() -> P<[T]> {
-        P::empty()
-    }
-
-    pub fn empty() -> P<[T]> {
         P { ptr: Default::default() }
     }
 
@@ -151,31 +141,11 @@ impl<T> P<[T]> {
     pub fn into_vec(self) -> Vec<T> {
         self.ptr.into_vec()
     }
-
-    pub fn as_slice<'a>(&'a self) -> &'a [T] {
-        &self.ptr
-    }
-
-    pub fn move_iter(self) -> vec::IntoIter<T> {
-        self.into_vec().into_iter()
-    }
-
-    pub fn map<U, F: FnMut(&T) -> U>(&self, f: F) -> P<[U]> {
-        self.iter().map(f).collect()
-    }
-}
-
-impl<T> Deref for P<[T]> {
-    type Target = [T];
-
-    fn deref(&self) -> &[T] {
-        self.as_slice()
-    }
 }
 
 impl<T> Default for P<[T]> {
     fn default() -> P<[T]> {
-        P::empty()
+        P::new()
     }
 }