about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2020-01-11 12:36:12 +0100
committerGitHub <noreply@github.com>2020-01-11 12:36:12 +0100
commitf02f338ee064cf78e0b2234cbbfcaf43c451217d (patch)
treea372a1ac0282bce8abd0d6d20f5b6169e13a1dbf
parent34231d6c0b60fc65f29b3a8c3523e11ec91113f4 (diff)
parent48cad460bc664d110c013b02a21ede7612f1a8e6 (diff)
downloadrust-f02f338ee064cf78e0b2234cbbfcaf43c451217d.tar.gz
rust-f02f338ee064cf78e0b2234cbbfcaf43c451217d.zip
Rollup merge of #68072 - JohnTitor:fix-macro-ice, r=petrochenkov
Fix ICE #68058

Fixes #68058

r? @petrochenkov
-rw-r--r--src/librustc_ast_lowering/expr.rs7
-rw-r--r--src/test/ui/macros/issue-68058.rs14
2 files changed, 20 insertions, 1 deletions
diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs
index ee020c7e589..9a229e709a5 100644
--- a/src/librustc_ast_lowering/expr.rs
+++ b/src/librustc_ast_lowering/expr.rs
@@ -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 {
diff --git a/src/test/ui/macros/issue-68058.rs b/src/test/ui/macros/issue-68058.rs
new file mode 100644
index 00000000000..24da2620c2e
--- /dev/null
+++ b/src/test/ui/macros/issue-68058.rs
@@ -0,0 +1,14 @@
+// check-pass
+
+macro_rules! foo {
+    ($doc: expr) => {
+        fn f() {
+            #[doc = $doc]
+            ()
+        }
+    };
+}
+
+foo!("doc");
+
+fn main() {}