]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/deriving/ty.rs
libsyntax: Mechanically change `~[T]` to `Vec<T>`
[rust.git] / src / libsyntax / ext / deriving / ty.rs
index 1d3dd9185caae8bf6db17be80390ed9717c40078..f7019d65058b93595f507c6bcb4246c8f3e8fba0 100644 (file)
@@ -30,22 +30,22 @@ pub enum PtrTy<'a> {
 /// A path, e.g. `::std::option::Option::<int>` (global). Has support
 /// for type parameters and a lifetime.
 pub struct Path<'a> {
-    path: ~[&'a str],
+    path: Vec<&'a str> ,
     lifetime: Option<&'a str>,
-    params: ~[~Ty<'a>],
+    params: Vec<~Ty<'a>> ,
     global: bool
 }
 
 impl<'a> Path<'a> {
-    pub fn new<'r>(path: ~[&'r str]) -> Path<'r> {
-        Path::new_(path, None, ~[], true)
+    pub fn new<'r>(path: Vec<&'r str> ) -> Path<'r> {
+        Path::new_(path, None, Vec::new(), true)
     }
     pub fn new_local<'r>(path: &'r str) -> Path<'r> {
-        Path::new_(~[ path ], None, ~[], false)
+        Path::new_(vec!( path ), None, Vec::new(), false)
     }
-    pub fn new_<'r>(path: ~[&'r str],
+    pub fn new_<'r>(path: Vec<&'r str> ,
                     lifetime: Option<&'r str>,
-                    params: ~[~Ty<'r>],
+                    params: Vec<~Ty<'r>> ,
                     global: bool)
                     -> Path<'r> {
         Path {
@@ -87,7 +87,7 @@ pub enum Ty<'a> {
     // parameter, and things like `int`
     Literal(Path<'a>),
     // includes nil
-    Tuple(~[Ty<'a>])
+    Tuple(Vec<Ty<'a>> )
 }
 
 pub fn borrowed_ptrty<'r>() -> PtrTy<'r> {
@@ -106,7 +106,7 @@ pub fn borrowed_self<'r>() -> Ty<'r> {
 }
 
 pub fn nil_ty() -> Ty<'static> {
-    Tuple(~[])
+    Tuple(Vec::new())
 }
 
 fn mk_lifetime(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifetime> {
@@ -172,7 +172,7 @@ pub fn to_path(&self,
                 });
                 let lifetimes = self_generics.lifetimes.clone();
 
-                cx.path_all(span, false, ~[self_ty], lifetimes,
+                cx.path_all(span, false, vec!(self_ty), lifetimes,
                             opt_vec::take_vec(self_params))
             }
             Literal(ref p) => {
@@ -195,7 +195,7 @@ fn mk_ty_param(cx: &ExtCtxt, span: Span, name: &str, bounds: &[Path],
     cx.typaram(cx.ident_of(name), bounds, None)
 }
 
-fn mk_generics(lifetimes: ~[ast::Lifetime],  ty_params: ~[ast::TyParam]) -> Generics {
+fn mk_generics(lifetimes: Vec<ast::Lifetime> ,  ty_params: Vec<ast::TyParam> ) -> Generics {
     Generics {
         lifetimes: opt_vec::from(lifetimes),
         ty_params: opt_vec::from(ty_params)
@@ -204,14 +204,14 @@ fn mk_generics(lifetimes: ~[ast::Lifetime],  ty_params: ~[ast::TyParam]) -> Gene
 
 /// Lifetimes and bounds on type parameters
 pub struct LifetimeBounds<'a> {
-    lifetimes: ~[&'a str],
-    bounds: ~[(&'a str, ~[Path<'a>])]
+    lifetimes: Vec<&'a str> ,
+    bounds: vec!((&'a str, Vec<Path<'a>> ))
 }
 
 impl<'a> LifetimeBounds<'a> {
     pub fn empty() -> LifetimeBounds<'static> {
         LifetimeBounds {
-            lifetimes: ~[], bounds: ~[]
+            lifetimes: Vec::new(), bounds: Vec::new()
         }
     }
     pub fn to_generics(&self,