Skip to content

Commit

Permalink
Fix ICE rust-lang#68058
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jan 9, 2020
1 parent 59eb49d commit 54f8601
Show file tree
Hide file tree
Showing 2 changed files with 21 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
15 changes: 15 additions & 0 deletions src/test/ui/macros/issue-68058.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// check-pass

macro_rules! def_target {
($target: expr) => {
#[target_feature(enable=$target)]
unsafe fn f() {
#[target_feature(enable=$target)]
()
}
};
}

def_target!("avx2");

fn main() {}

0 comments on commit 54f8601

Please sign in to comment.