Skip to content

Commit

Permalink
Rollup merge of #68072 - JohnTitor:fix-macro-ice, r=petrochenkov
Browse files Browse the repository at this point in the history
Fix ICE #68058

Fixes #68058

r? @petrochenkov
  • Loading branch information
Centril committed Jan 11, 2020
2 parents 34231d6 + 48cad46 commit f02f338
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/librustc_ast_lowering/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
ExprKind::Mac(_) => panic!("Shouldn't exist here"),
};

hir::Expr { hir_id: self.lower_node_id(e.id), kind, span: e.span, attrs: e.attrs.clone() }
hir::Expr {
hir_id: self.lower_node_id(e.id),
kind,
span: e.span,
attrs: e.attrs.iter().map(|a| self.lower_attr(a)).collect::<Vec<_>>().into(),
}
}

fn lower_unop(&mut self, u: UnOp) -> hir::UnOp {
Expand Down
14 changes: 14 additions & 0 deletions src/test/ui/macros/issue-68058.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// check-pass

macro_rules! foo {
($doc: expr) => {
fn f() {
#[doc = $doc]
()
}
};
}

foo!("doc");

fn main() {}

0 comments on commit f02f338

Please sign in to comment.