Rollup merge of #34213 - josephDunne:trait_item_macros, r=jseyfried

**syntax-[breaking-change]** cc #31645
New `TraitItemKind::Macro` variant

This change adds support for macro expansion inside trait items by adding the new `TraitItemKind::Macro` and associated parsing code.
This commit is contained in:
Jeffrey Seyfried
2016-06-25 22:05:08 +00:00
15 changed files with 240 additions and 88 deletions

View File

@@ -1550,6 +1550,17 @@ impl<'a> State<'a> {
try!(self.print_associated_type(ti.ident, Some(bounds),
default.as_ref().map(|ty| &**ty)));
}
ast::TraitItemKind::Macro(codemap::Spanned { ref node, .. }) => {
// code copied from ItemKind::Mac:
self.print_path(&node.path, false, 0)?;
word(&mut self.s, "! ")?;
self.cbox(INDENT_UNIT)?;
self.popen()?;
self.print_tts(&node.tts[..])?;
self.pclose()?;
word(&mut self.s, ";")?;
self.end()?
}
}
self.ann.post(self, NodeSubItem(ti.id))
}