Skip to content

Commit 544c981

Browse files
authored
Rollup merge of #68072 - JohnTitor:fix-macro-ice, r=petrochenkov
Fix ICE #68058 Fixes #68058 r? @petrochenkov
2 parents b2027df + 48cad46 commit 544c981

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/librustc_ast_lowering/expr.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
202202
ExprKind::Mac(_) => panic!("Shouldn't exist here"),
203203
};
204204

205-
hir::Expr { hir_id: self.lower_node_id(e.id), kind, span: e.span, attrs: e.attrs.clone() }
205+
hir::Expr {
206+
hir_id: self.lower_node_id(e.id),
207+
kind,
208+
span: e.span,
209+
attrs: e.attrs.iter().map(|a| self.lower_attr(a)).collect::<Vec<_>>().into(),
210+
}
206211
}
207212

208213
fn lower_unop(&mut self, u: UnOp) -> hir::UnOp {

src/test/ui/macros/issue-68058.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// check-pass
2+
3+
macro_rules! foo {
4+
($doc: expr) => {
5+
fn f() {
6+
#[doc = $doc]
7+
()
8+
}
9+
};
10+
}
11+
12+
foo!("doc");
13+
14+
fn main() {}

0 commit comments

Comments
 (0)