]> git.lizzy.rs Git - rust.git/commitdiff
Add a macro invocation to the type AST
authorJared Roesch <roeschinc@gmail.com>
Sun, 26 Jul 2015 04:30:35 +0000 (21:30 -0700)
committerJared Roesch <roeschinc@gmail.com>
Tue, 4 Aug 2015 23:05:06 +0000 (16:05 -0700)
Reapplied the changes from https://github.com/freebroccolo/rust/commit/dc64b731d7f66c2b43d5e5e8c721be7bd3b59540
to a clean branch of master

src/librustc_typeck/astconv.rs
src/librustdoc/clean/mod.rs
src/libsyntax/ast.rs
src/libsyntax/fold.rs
src/libsyntax/print/pprust.rs
src/libsyntax/visit.rs

index a2c968a290b8a189d66dbeca22ddae7febd6e129..cfd681e51f4e1c18569468f0f40f41a45e44b2ed 100644 (file)
@@ -1662,6 +1662,9 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
             // handled specially and will not descend into this routine.
             this.ty_infer(None, None, None, ast_ty.span)
         }
+        ast::TyMac(_) => {
+            tcx.sess.span_bug(m.span, "unexpanded type macro found conversion")
+        }
     };
 
     tcx.ast_ty_to_ty_cache.borrow_mut().insert(ast_ty.id, typ);
index 11a0e0eaa496e65dc68ffa1c9dae050a600a3437..a79a571f0c7a4685a92abd19467f00bc8bdd3bb6 100644 (file)
@@ -1611,6 +1611,9 @@ fn clean(&self, cx: &DocContext) -> Type {
             TyTypeof(..) => {
                 panic!("Unimplemented type {:?}", self.node)
             },
+            TyMac(..) => {
+                cx.tcx().sess.span_bug(m.span, "unexpanded type macro found during cleaning")
+            }
         }
     }
 }
index db173d08308158e6e99c73dea98c14501978ee2a..eefd3da9f4af31734bb9d938efa9bf31844fccea 100644 (file)
@@ -1471,6 +1471,8 @@ pub enum Ty_ {
     /// TyInfer means the type should be inferred instead of it having been
     /// specified. This can appear anywhere in a type.
     TyInfer,
+    // A macro in the type position.
+    TyMac(Mac)
 }
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
index dab6d41df300375d5e9d6536066f6c13007c52f6..72fe9a7711d993d2de8d8fe99cc995d63dabb4f1 100644 (file)
@@ -429,6 +429,9 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> {
             TyPolyTraitRef(bounds) => {
                 TyPolyTraitRef(bounds.move_map(|b| fld.fold_ty_param_bound(b)))
             }
+            TyMac(mac) => {
+                TyMac(fld.fold_mac(mac))
+            }
         },
         span: fld.new_span(span)
     })
index 6cfe85bc37e8171324258cbcda76f322457931f9..17fa0922da9efcfca224936c09872156580d0004 100644 (file)
@@ -734,6 +734,9 @@ pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
             ast::TyInfer => {
                 try!(word(&mut self.s, "_"));
             }
+            ast::TyMac(ref m) => {
+                try!(self.print_mac(m, token::Paren));
+            }
         }
         self.end()
     }
index 649052d123c8813fe3daa7b72470f03a14d8a2ec..b32ed15b50f9dc01e5fd838382fd284dcff82ad9 100644 (file)
@@ -405,6 +405,9 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
             visitor.visit_expr(&**expression)
         }
         TyInfer => {}
+        TyMac(ref mac) => {
+            visitor.visit_mac(mac)
+        }
     }
 }