Skip to content

Commit 54f8601

Browse files
committed
Fix ICE #68058
1 parent 59eb49d commit 54f8601

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-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

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

0 commit comments

Comments
 (0)