about summary refs log tree commit diff
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
parent97c5a44d3e805652a54a5693bbf2ab6d44db993b (diff)
downloadrust-46a1f54666dbeb9a926c75b380f62571963cbacc.tar.gz
rust-46a1f54666dbeb9a926c75b380f62571963cbacc.zip
De-manage OptVec<TyParamBounds>
-rw-r--r--src/librustc/metadata/encoder.rs2
-rw-r--r--src/librustc/middle/kind.rs2
-rw-r--r--src/librustc/middle/region.rs4
-rw-r--r--src/librustc/middle/resolve.rs2
-rw-r--r--src/librustc/middle/typeck/astconv.rs4
-rw-r--r--src/librustc/middle/typeck/collect.rs4
-rw-r--r--src/libsyntax/ast.rs4
-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
-rw-r--r--src/libsyntax/fold.rs9
-rw-r--r--src/libsyntax/opt_vec.rs9
-rw-r--r--src/libsyntax/parse/parser.rs6
-rw-r--r--src/libsyntax/print/pprust.rs4
-rw-r--r--src/libsyntax/visit.rs4
17 files changed, 58 insertions, 56 deletions
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs
index 9b4c39b3fc7..8273b3e663a 100644
--- a/src/librustc/metadata/encoder.rs
+++ b/src/librustc/metadata/encoder.rs
@@ -1014,7 +1014,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
         encode_name(ecx, ebml_w, item.ident);
         encode_attributes(ebml_w, item.attrs);
         match ty.node {
-            ast::ty_path(ref path, bounds, _) if path.idents.len() == 1 => {
+            ast::ty_path(ref path, ref bounds, _) if path.idents.len() == 1 => {
                 assert!(bounds.is_none());
                 encode_impl_type_basename(ecx, ebml_w,
                                           ast_util::path_to_ident(path));
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index 0c493fe9e81..0bc7a4a0114 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -125,7 +125,7 @@ fn check_item(item: @item, (cx, visitor): (Context, visit::vt<Context>)) {
                         if cx.tcx.lang_items.drop_trait() == trait_def_id {
                             // Yes, it's a destructor.
                             match self_type.node {
-                                ty_path(_, bounds, path_node_id) => {
+                                ty_path(_, ref bounds, path_node_id) => {
                                     assert!(bounds.is_none());
                                     let struct_def = cx.tcx.def_map.get_copy(
                                         &path_node_id);
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index a5b64ea4268..f76d9541baa 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -784,7 +784,7 @@ fn determine_rp_in_ty(ty: @ast::Ty,
     // then check whether it is region-parameterized and consider
     // that as a direct dependency.
     match ty.node {
-      ast::ty_path(ref path, _bounds, id) => {
+      ast::ty_path(ref path, _, id) => {
         match cx.def_map.find(&id) {
           Some(&ast::def_ty(did)) |
           Some(&ast::def_trait(did)) |
@@ -820,7 +820,7 @@ fn determine_rp_in_ty(ty: @ast::Ty,
         visit_mt(mt, (cx, visitor));
       }
 
-      ast::ty_path(ref path, _bounds, _) => {
+      ast::ty_path(ref path, _, _) => {
         // type parameters are---for now, anyway---always invariant
         do cx.with_ambient_variance(rv_invariant) {
             for path.types.iter().advance |tp| {
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 3b90d72deb1..99ec1ccb1f1 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -4117,7 +4117,7 @@ impl Resolver {
             // Like path expressions, the interpretation of path types depends
             // on whether the path has multiple elements in it or not.
 
-            ty_path(ref path, bounds, path_id) => {
+            ty_path(ref path, ref bounds, path_id) => {
                 // This is a path in the type namespace. Walk through scopes
                 // scopes looking for it.
                 let mut result_def = None;
diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs
index e224654f2d3..6aac077bbd9 100644
--- a/src/librustc/middle/typeck/astconv.rs
+++ b/src/librustc/middle/typeck/astconv.rs
@@ -276,7 +276,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + 'static>(
                 }
                 return ty::mk_evec(tcx, mt, vst);
             }
-            ast::ty_path(ref path, bounds, id) => {
+            ast::ty_path(ref path, ref bounds, id) => {
                 // Note that the "bounds must be empty if path is not a trait"
                 // restriction is enforced in the below case for ty_path, which
                 // will run after this as long as the path isn't a trait.
@@ -405,7 +405,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:region_scope + Copy + 'static>(
                                       ast_ty.span);
           ty::mk_closure(tcx, fn_decl)
       }
-      ast::ty_path(ref path, bounds, id) => {
+      ast::ty_path(ref path, ref bounds, id) => {
         let a_def = match tcx.def_map.find(&id) {
           None => tcx.sess.span_fatal(
               ast_ty.span, fmt!("unbound path %s",
diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs
index 60f97a0ae0a..edd90be2647 100644
--- a/src/librustc/middle/typeck/collect.rs
+++ b/src/librustc/middle/typeck/collect.rs
@@ -1149,7 +1149,7 @@ pub fn ty_generics(ccx: &CrateCtxt,
                     let param_ty = ty::param_ty {idx: base_index + offset,
                                                  def_id: local_def(param.id)};
                     let bounds = @compute_bounds(ccx, rp, generics,
-                                                 param_ty, param.bounds);
+                                                 param_ty, &param.bounds);
                     let def = ty::TypeParameterDef {
                         def_id: local_def(param.id),
                         bounds: bounds
@@ -1167,7 +1167,7 @@ pub fn ty_generics(ccx: &CrateCtxt,
         rp: Option<ty::region_variance>,
         generics: &ast::Generics,
         param_ty: ty::param_ty,
-        ast_bounds: @OptVec<ast::TyParamBound>) -> ty::ParamBounds
+        ast_bounds: &OptVec<ast::TyParamBound>) -> ty::ParamBounds
     {
         /*!
          *
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index a222f03820f..d0c8ff03e38 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -140,7 +140,7 @@ pub enum TyParamBound {
 pub struct TyParam {
     ident: ident,
     id: node_id,
-    bounds: @OptVec<TyParamBound>
+    bounds: OptVec<TyParamBound>
 }
 
 #[deriving(Eq, Encodable, Decodable,IterBytes)]
@@ -734,7 +734,7 @@ pub enum ty_ {
     ty_closure(@TyClosure),
     ty_bare_fn(@TyBareFn),
     ty_tup(~[@Ty]),
-    ty_path(Path, @Option<OptVec<TyParamBound>>, node_id), // for #7264; see above
+    ty_path(Path, Option<OptVec<TyParamBound>>, node_id), // for #7264; see above
     ty_mac(mac),
     // ty_infer means the type should be inferred instead of it having been
     // specified. This should only appear at the "top level" of a type and not
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
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 85eb499069b..c6592d36e40 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -171,12 +171,13 @@ pub fn fold_ty_param(tp: TyParam,
                      fld: @ast_fold) -> TyParam {
     TyParam {ident: tp.ident,
              id: fld.new_id(tp.id),
-             bounds: @tp.bounds.map(|x| fold_ty_param_bound(x, fld))}
+             bounds: tp.bounds.map(|x| fold_ty_param_bound(x, fld))}
 }
 
 pub fn fold_ty_params(tps: &OptVec<TyParam>,
                       fld: @ast_fold) -> OptVec<TyParam> {
-    tps.map(|tp| fold_ty_param(*tp, fld))
+    let tps = /*bad*/ copy *tps;
+    tps.map_consume(|tp| fold_ty_param(tp, fld))
 }
 
 pub fn fold_lifetime(l: &Lifetime,
@@ -682,8 +683,8 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ {
             })
         }
         ty_tup(ref tys) => ty_tup(tys.map(|ty| fld.fold_ty(*ty))),
-        ty_path(ref path, bounds, id) =>
-            ty_path(fld.fold_path(path), @fold_opt_bounds(bounds, fld), fld.new_id(id)),
+        ty_path(ref path, ref bounds, id) =>
+            ty_path(fld.fold_path(path), fold_opt_bounds(bounds, fld), fld.new_id(id)),
         ty_fixed_length_vec(ref mt, e) => {
             ty_fixed_length_vec(
                 fold_mt(mt, fld),
diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs
index 8e2da3d6eb1..ba3b72ec194 100644
--- a/src/libsyntax/opt_vec.rs
+++ b/src/libsyntax/opt_vec.rs
@@ -16,7 +16,7 @@
  * other useful things like `push()` and `len()`.
  */
 
-use std::vec::VecIterator;
+use std::vec::{VecIterator};
 
 #[deriving(Encodable, Decodable,IterBytes)]
 pub enum OptVec<T> {
@@ -58,6 +58,13 @@ impl<T> OptVec<T> {
         }
     }
 
+    fn map_consume<U>(self, op: &fn(T) -> U) -> OptVec<U> {
+        match self {
+            Empty => Empty,
+            Vec(v) => Vec(v.consume_iter().transform(op).collect())
+        }
+    }
+
     fn get<'a>(&'a self, i: uint) -> &'a T {
         match *self {
             Empty => fail!("Invalid index %u", i),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 8f1bffdaa78..4c662cc4621 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -968,7 +968,7 @@ impl Parser {
             || is_ident_or_path(self.token) {
             // NAMED TYPE
             let (path, bounds) = self.parse_type_path();
-            ty_path(path, @bounds, self.get_id())
+            ty_path(path, bounds, self.get_id())
         } else {
             self.fatal(fmt!("expected type, found token %?",
                             *self.token));
@@ -3213,7 +3213,7 @@ impl Parser {
         let ident = self.parse_ident();
         let opt_bounds = self.parse_optional_ty_param_bounds();
         // For typarams we don't care about the difference b/w "<T>" and "<T:>".
-        let bounds = @opt_bounds.get_or_default(opt_vec::Empty);
+        let bounds = opt_bounds.get_or_default(opt_vec::Empty);
         ast::TyParam { ident: ident, id: self.get_id(), bounds: bounds }
     }
 
@@ -3565,7 +3565,7 @@ impl Parser {
         let opt_trait = if could_be_trait && self.eat_keyword(keywords::For) {
             // New-style trait. Reinterpret the type as a trait.
             let opt_trait_ref = match ty.node {
-                ty_path(ref path, @None, node_id) => {
+                ty_path(ref path, None, node_id) => {
                     Some(trait_ref {
                         path: /* bad */ copy *path,
                         ref_id: node_id
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index d90055caffb..d054f927894 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -418,7 +418,7 @@ pub fn print_type(s: @ps, ty: &ast::Ty) {
                       f.purity, f.onceness, &f.decl, None, &f.bounds,
                       Some(&generics), None);
       }
-      ast::ty_path(ref path, bounds, _) => print_bounded_path(s, path, bounds),
+      ast::ty_path(ref path, ref bounds, _) => print_bounded_path(s, path, bounds),
       ast::ty_fixed_length_vec(ref mt, v) => {
         word(s.s, "[");
         match mt.mutbl {
@@ -1773,7 +1773,7 @@ pub fn print_generics(s: @ps, generics: &ast::Generics) {
                 let idx = idx - generics.lifetimes.len();
                 let param = generics.ty_params.get(idx);
                 print_ident(s, param.ident);
-                print_bounds(s, param.bounds, false);
+                print_bounds(s, &param.bounds, false);
             }
         }
 
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 4be9ef13db2..b513b68b74f 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -252,7 +252,7 @@ pub fn visit_ty<E: Copy>(t: &Ty, (e, v): (E, vt<E>)) {
             for f.decl.inputs.iter().advance |a| { (v.visit_ty)(a.ty, (copy e, v)); }
             (v.visit_ty)(f.decl.output, (e, v));
         },
-        ty_path(ref p, bounds, _) => {
+        ty_path(ref p, ref bounds, _) => {
             visit_path(p, (copy e, v));
             do bounds.map |bounds| {
                 visit_ty_param_bounds(bounds, (copy e, v));
@@ -344,7 +344,7 @@ pub fn visit_ty_param_bounds<E: Copy>(bounds: &OptVec<TyParamBound>,
 
 pub fn visit_generics<E: Copy>(generics: &Generics, (e, v): (E, vt<E>)) {
     for generics.ty_params.iter().advance |tp| {
-        visit_ty_param_bounds(tp.bounds, (copy e, v));
+        visit_ty_param_bounds(&tp.bounds, (copy e, v));
     }
 }