about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-04-22 23:43:14 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2016-04-24 21:04:09 +0300
commit9108fb7bae11f18715d971eeae1e5ca84662e1ee (patch)
treea1a4f5f13a8e0d409d6077796e46afbec162ff34 /src/libsyntax
parenta97f60ee8618fde7bafe49d79a3ea670758e6a0c (diff)
downloadrust-9108fb7bae11f18715d971eeae1e5ca84662e1ee.tar.gz
rust-9108fb7bae11f18715d971eeae1e5ca84662e1ee.zip
Remove some old code from libsyntax
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs6
-rw-r--r--src/libsyntax/lib.rs1
-rw-r--r--src/libsyntax/owned_slice.rs14
-rw-r--r--src/libsyntax/parse/mod.rs2
-rw-r--r--src/libsyntax/parse/parser.rs4
-rw-r--r--src/libsyntax/print/pprust.rs4
-rw-r--r--src/libsyntax/ptr.rs42
7 files changed, 14 insertions, 59 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 6bcd8085315..5064bcba4c3 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -248,8 +248,8 @@ impl PathParameters {
     pub fn none() -> PathParameters {
         PathParameters::AngleBracketed(AngleBracketedParameterData {
             lifetimes: Vec::new(),
-            types: P::empty(),
-            bindings: P::empty(),
+            types: P::new(),
+            bindings: P::new(),
         })
     }
 
@@ -421,7 +421,7 @@ impl Default for Generics {
     fn default() ->  Generics {
         Generics {
             lifetimes: Vec::new(),
-            ty_params: P::empty(),
+            ty_params: P::new(),
             where_clause: WhereClause {
                 id: DUMMY_NODE_ID,
                 predicates: Vec::new(),
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index f38720c3e50..6cfa1e9847b 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -97,7 +97,6 @@ pub mod config;
 pub mod entry;
 pub mod feature_gate;
 pub mod fold;
-pub mod owned_slice;
 pub mod parse;
 pub mod ptr;
 pub mod show_span;
diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs
deleted file mode 100644
index 33a3d578598..00000000000
--- a/src/libsyntax/owned_slice.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/// A non-growable owned slice.
-#[unstable(feature = "rustc_private", issue = "0")]
-#[rustc_deprecated(since = "1.7.0", reason = "use `ptr::P<[T]>` instead")]
-pub type OwnedSlice<T> = ::ptr::P<[T]>;
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 7534683a206..c2050d2a8f4 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -925,7 +925,7 @@ mod tests {
                                     Abi::Rust,
                                     ast::Generics{ // no idea on either of these:
                                         lifetimes: Vec::new(),
-                                        ty_params: P::empty(),
+                                        ty_params: P::new(),
                                         where_clause: ast::WhereClause {
                                             id: ast::DUMMY_NODE_ID,
                                             predicates: Vec::new(),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7842d9dca53..4fb423f787e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1160,7 +1160,7 @@ impl<'a> Parser<'a> {
             let other_bounds = if self.eat(&token::BinOp(token::Plus)) {
                 self.parse_ty_param_bounds(BoundParsingMode::Bare)?
             } else {
-                P::empty()
+                P::new()
             };
             let all_bounds =
                 Some(TraitTyParamBound(poly_trait_ref, TraitBoundModifier::None)).into_iter()
@@ -4239,7 +4239,7 @@ impl<'a> Parser<'a> {
                                         -> PResult<'a, TyParamBounds>
     {
         if !self.eat(&token::Colon) {
-            Ok(P::empty())
+            Ok(P::new())
         } else {
             self.parse_ty_param_bounds(mode)
         }
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 798477d8fe5..1c6ecbd3b5a 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -995,7 +995,7 @@ impl<'a> State<'a> {
             ast::TyKind::BareFn(ref f) => {
                 let generics = ast::Generics {
                     lifetimes: f.lifetimes.clone(),
-                    ty_params: P::empty(),
+                    ty_params: P::new(),
                     where_clause: ast::WhereClause {
                         id: ast::DUMMY_NODE_ID,
                         predicates: Vec::new(),
@@ -3011,7 +3011,7 @@ impl<'a> State<'a> {
         }
         let generics = ast::Generics {
             lifetimes: Vec::new(),
-            ty_params: P::empty(),
+            ty_params: P::new(),
             where_clause: ast::WhereClause {
                 id: ast::DUMMY_NODE_ID,
                 predicates: Vec::new(),
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()
     }
 }