Fix ICE with nested macros in certain situations.

This commit is contained in:
Jeffrey Seyfried 2017-03-25 04:04:13 +00:00
parent 49c67bd632
commit 29a052d2d8
2 changed files with 20 additions and 1 deletions

View file

@ -106,8 +106,8 @@ impl<'a, 'b> PlaceholderExpander<'a, 'b> {
impl<'a, 'b> Folder for PlaceholderExpander<'a, 'b> {
fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
match item.node {
ast::ItemKind::Mac(ref mac) if !mac.node.path.segments.is_empty() => {}
ast::ItemKind::Mac(_) => return self.remove(item.id).make_items(),
ast::ItemKind::MacroDef(_) => return SmallVector::one(item),
_ => {}
}