Rollup merge of #68072 - JohnTitor:fix-macro-ice, r=petrochenkov

Fix ICE #68058

Fixes #68058

r? @petrochenkov
This commit is contained in:
Mazdak Farrokhzad 2020-01-11 12:36:12 +01:00 committed by GitHub
commit f02f338ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -202,7 +202,12 @@ pub(super) fn lower_expr_mut(&mut self, e: &Expr) -> hir::Expr<'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 {

View File

@ -0,0 +1,14 @@
// check-pass
macro_rules! foo {
($doc: expr) => {
fn f() {
#[doc = $doc]
()
}
};
}
foo!("doc");
fn main() {}