about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorJames Miller <bladeon@gmail.com>2013-07-06 13:38:56 +1200
committerJames Miller <bladeon@gmail.com>2013-07-07 22:51:10 +1200
commit46a1f54666dbeb9a926c75b380f62571963cbacc (patch)
tree1ef88fa9ef34af53d983b4ef5d4a70792c3ddaba /src/libsyntax/ext
parent97c5a44d3e805652a54a5693bbf2ab6d44db993b (diff)
downloadrust-46a1f54666dbeb9a926c75b380f62571963cbacc.tar.gz
rust-46a1f54666dbeb9a926c75b380f62571963cbacc.zip
De-manage OptVec<TyParamBounds>
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/build.rs18
-rw-r--r--src/libsyntax/ext/deriving/generic.rs5
-rw-r--r--src/libsyntax/ext/deriving/ty.rs8
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs27
-rw-r--r--src/libsyntax/ext/pipes/proto.rs2
5 files changed, 27 insertions, 33 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 68b011e4fd7..0388115d7ef 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -46,7 +46,7 @@ pub trait AstBuilder {
     fn ty_mt(&self, ty: @ast::Ty, mutbl: ast::mutability) -> ast::mt;
 
     fn ty(&self, span: span, ty: ast::ty_) -> @ast::Ty;
-    fn ty_path(&self, ast::Path, @Option<OptVec<ast::TyParamBound>>) -> @ast::Ty;
+    fn ty_path(&self, ast::Path, Option<OptVec<ast::TyParamBound>>) -> @ast::Ty;
     fn ty_ident(&self, span: span, idents: ast::ident) -> @ast::Ty;
 
     fn ty_rptr(&self, span: span,
@@ -66,7 +66,7 @@ pub trait AstBuilder {
     fn ty_field_imm(&self, span: span, name: ident, ty: @ast::Ty) -> ast::ty_field;
     fn strip_bounds(&self, bounds: &Generics) -> Generics;
 
-    fn typaram(&self, id: ast::ident, bounds: @OptVec<ast::TyParamBound>) -> ast::TyParam;
+    fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam;
 
     fn trait_ref(&self, path: ast::Path) -> ast::trait_ref;
     fn typarambound(&self, path: ast::Path) -> ast::TyParamBound;
@@ -265,7 +265,7 @@ impl AstBuilder for @ExtCtxt {
         }
     }
 
-    fn ty_path(&self, path: ast::Path, bounds: @Option<OptVec<ast::TyParamBound>>)
+    fn ty_path(&self, path: ast::Path, bounds: Option<OptVec<ast::TyParamBound>>)
               -> @ast::Ty {
         self.ty(path.span,
                 ast::ty_path(path, bounds, self.next_id()))
@@ -275,7 +275,7 @@ impl AstBuilder for @ExtCtxt {
     // to generate a bounded existential trait type.
     fn ty_ident(&self, span: span, ident: ast::ident)
         -> @ast::Ty {
-        self.ty_path(self.path_ident(span, ident), @None)
+        self.ty_path(self.path_ident(span, ident), None)
     }
 
     fn ty_rptr(&self,
@@ -305,8 +305,7 @@ impl AstBuilder for @ExtCtxt {
                               self.ident_of("Option")
                           ],
                           None,
-                          ~[ ty ]),
-            @None)
+                          ~[ ty ]), None)
     }
 
     fn ty_field_imm(&self, span: span, name: ident, ty: @ast::Ty) -> ast::ty_field {
@@ -329,7 +328,7 @@ impl AstBuilder for @ExtCtxt {
         }
     }
 
-    fn typaram(&self, id: ast::ident, bounds: @OptVec<ast::TyParamBound>) -> ast::TyParam {
+    fn typaram(&self, id: ast::ident, bounds: OptVec<ast::TyParamBound>) -> ast::TyParam {
         ast::TyParam { ident: id, id: self.next_id(), bounds: bounds }
     }
 
@@ -344,13 +343,12 @@ impl AstBuilder for @ExtCtxt {
     fn ty_vars_global(&self, ty_params: &OptVec<ast::TyParam>) -> ~[@ast::Ty] {
         opt_vec::take_vec(
             ty_params.map(|p| self.ty_path(
-                self.path_global(dummy_sp(), ~[p.ident]), @None)))
+                self.path_global(dummy_sp(), ~[p.ident]), None)))
     }
 
     fn strip_bounds(&self, generics: &Generics) -> Generics {
-        let no_bounds = @opt_vec::Empty;
         let new_params = do generics.ty_params.map |ty_param| {
-            ast::TyParam { bounds: no_bounds, ..copy *ty_param }
+            ast::TyParam { bounds: opt_vec::Empty, ..copy *ty_param }
         };
         Generics {
             ty_params: new_params,
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index 8bd74b96afc..10282cb6f0a 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -337,7 +337,7 @@ impl<'self> TraitDef<'self> {
             // require the current trait
             bounds.push(cx.typarambound(copy trait_path));
 
-            trait_generics.ty_params.push(cx.typaram(ty_param.ident, @bounds));
+            trait_generics.ty_params.push(cx.typaram(ty_param.ident, bounds));
         }
 
         // Create the reference to the trait.
@@ -356,8 +356,7 @@ impl<'self> TraitDef<'self> {
 
         // Create the type of `self`.
         let self_type = cx.ty_path(cx.path_all(span, false, ~[ type_ident ], self_lifetime,
-                                               opt_vec::take_vec(self_ty_params)),
-                                   @None);
+                                               opt_vec::take_vec(self_ty_params)), None);
 
         let doc_attr = cx.attribute(
             span,
diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs
index 2a60a20b872..c820371714b 100644
--- a/src/libsyntax/ext/deriving/ty.rs
+++ b/src/libsyntax/ext/deriving/ty.rs
@@ -62,8 +62,7 @@ impl<'self> Path<'self> {
                  self_ty: ident,
                  self_generics: &Generics)
                  -> @ast::Ty {
-        cx.ty_path(self.to_path(cx, span,
-                                self_ty, self_generics), @None)
+        cx.ty_path(self.to_path(cx, span, self_ty, self_generics), None)
     }
     pub fn to_path(&self,
                    cx: @ExtCtxt,
@@ -142,8 +141,7 @@ impl<'self> Ty<'self> {
             }
             Literal(ref p) => { p.to_ty(cx, span, self_ty, self_generics) }
             Self  => {
-                cx.ty_path(self.to_path(cx, span, self_ty, self_generics),
-                           @None)
+                cx.ty_path(self.to_path(cx, span, self_ty, self_generics), None)
             }
             Tuple(ref fields) => {
                 let ty = if fields.is_empty() {
@@ -194,7 +192,7 @@ fn mk_ty_param(cx: @ExtCtxt, span: span, name: &str, bounds: &[Path],
             let path = b.to_path(cx, span, self_ident, self_generics);
             cx.typarambound(path)
         });
-    cx.typaram(cx.ident_of(name), @bounds)
+    cx.typaram(cx.ident_of(name), bounds)
 }
 
 fn mk_generics(lifetimes: ~[ast::Lifetime],  ty_params: ~[ast::TyParam]) -> Generics {
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 0e24725ea99..57174f216fe 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -60,7 +60,7 @@ impl gen_send for message {
 
             let pipe_ty = cx.ty_path(
                 path(~[this.data_name()], span)
-                .add_tys(cx.ty_vars(&this.generics.ty_params)), @None);
+                .add_tys(cx.ty_vars(&this.generics.ty_params)), None);
             let args_ast = vec::append(
                 ~[cx.arg(span, cx.ident_of("pipe"), pipe_ty)],
                 args_ast);
@@ -117,7 +117,7 @@ impl gen_send for message {
 
             let mut rty = cx.ty_path(path(~[next.data_name()],
                                           span)
-                                     .add_tys(copy next_state.tys), @None);
+                                     .add_tys(copy next_state.tys), None);
             if try {
                 rty = cx.ty_option(rty);
             }
@@ -145,7 +145,7 @@ impl gen_send for message {
                              cx.ty_path(
                                  path(~[this.data_name()], span)
                                  .add_tys(cx.ty_vars(
-                                     &this.generics.ty_params)), @None))],
+                                     &this.generics.ty_params)), None))],
                     args_ast);
 
                 let message_args = if arg_names.len() == 0 {
@@ -191,7 +191,7 @@ impl gen_send for message {
 
     fn to_ty(&mut self, cx: @ExtCtxt) -> @ast::Ty {
         cx.ty_path(path(~[cx.ident_of(self.name())], self.span())
-          .add_tys(cx.ty_vars(&self.get_generics().ty_params)), @None)
+          .add_tys(cx.ty_vars(&self.get_generics().ty_params)), None)
     }
 }
 
@@ -225,7 +225,7 @@ impl to_type_decls for state {
                                 cx.ty_path(
                                     path(~[cx.ident_of(dir),
                                            cx.ident_of(next_name)], span)
-                                    .add_tys(copy next_state.tys), @None))
+                                    .add_tys(copy next_state.tys), None))
               }
               None => tys
             };
@@ -278,8 +278,7 @@ impl to_type_decls for state {
                                    self.data_name()],
                                  dummy_sp())
                             .add_tys(cx.ty_vars(
-                                &self.generics.ty_params)), @None)),
-                        @None),
+                                &self.generics.ty_params)), None)), None),
                     cx.strip_bounds(&self.generics)));
         }
         else {
@@ -298,8 +297,8 @@ impl to_type_decls for state {
                                    self.data_name()],
                                         dummy_sp())
                             .add_tys(cx.ty_vars_global(
-                                &self.generics.ty_params)), @None),
-                                   self.proto.buffer_ty_path(cx)]), @None),
+                                &self.generics.ty_params)), None),
+                                   self.proto.buffer_ty_path(cx)]), None),
                     cx.strip_bounds(&self.generics)));
         };
         items
@@ -372,10 +371,10 @@ impl gen_init for protocol {
 
     fn buffer_ty_path(&self, cx: @ExtCtxt) -> @ast::Ty {
         let mut params: OptVec<ast::TyParam> = opt_vec::Empty;
-        for (copy self.states).iter().advance |s| {
+        for self.states.iter().advance |s| {
             for s.generics.ty_params.iter().advance |tp| {
                 match params.iter().find_(|tpp| tp.ident == tpp.ident) {
-                  None => params.push(*tp),
+                  None => params.push(copy *tp),
                   _ => ()
                 }
             }
@@ -384,16 +383,16 @@ impl gen_init for protocol {
         cx.ty_path(path(~[cx.ident_of("super"),
                           cx.ident_of("__Buffer")],
                         copy self.span)
-                   .add_tys(cx.ty_vars_global(&params)), @None)
+                   .add_tys(cx.ty_vars_global(&params)), None)
     }
 
     fn gen_buffer_type(&self, cx: @ExtCtxt) -> @ast::item {
         let ext_cx = cx;
         let mut params: OptVec<ast::TyParam> = opt_vec::Empty;
-        let fields = do (copy self.states).iter().transform |s| {
+        let fields = do self.states.iter().transform |s| {
             for s.generics.ty_params.iter().advance |tp| {
                 match params.iter().find_(|tpp| tp.ident == tpp.ident) {
-                  None => params.push(*tp),
+                  None => params.push(copy *tp),
                   _ => ()
                 }
             }
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 0525c666478..f3d7158de52 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -99,7 +99,7 @@ impl state_ {
     pub fn to_ty(&self, cx: @ExtCtxt) -> @ast::Ty {
         cx.ty_path
             (path(~[cx.ident_of(self.name)],self.span).add_tys(
-                cx.ty_vars(&self.generics.ty_params)), @None)
+                cx.ty_vars(&self.generics.ty_params)), None)
     }
 
     /// Iterate over the states that can be reached in one message