Add a macro invocation to the type AST
Reapplied the changes from dc64b731d7
to a clean branch of master
This commit is contained in:
parent
6afb8f58d1
commit
ad5927870c
6 changed files with 17 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1611,6 +1611,9 @@ impl Clean<Type> for ast::Ty {
|
|||
TyTypeof(..) => {
|
||||
panic!("Unimplemented type {:?}", self.node)
|
||||
},
|
||||
TyMac(..) => {
|
||||
cx.tcx().sess.span_bug(m.span, "unexpanded type macro found during cleaning")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -734,6 +734,9 @@ impl<'a> State<'a> {
|
|||
ast::TyInfer => {
|
||||
try!(word(&mut self.s, "_"));
|
||||
}
|
||||
ast::TyMac(ref m) => {
|
||||
try!(self.print_mac(m, token::Paren));
|
||||
}
|
||||
}
|
||||
self.end()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue