Skip to content

Commit

Permalink
Rollup merge of rust-lang#68072 - JohnTitor:fix-macro-ice, r=petroche…
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril authored Jan 11, 2020
2 parents b2027df + 48cad46 commit 544c981
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 544c981

Please sign in to comment.