1
Fork 0

Do not store attrs in FnKind.

This commit is contained in:
Camille GILLOT 2020-11-27 09:24:42 +01:00
parent f5dc5dcca3
commit 8e816056a5
16 changed files with 51 additions and 70 deletions

View file

@ -46,7 +46,7 @@ impl<'tcx> Visitor<'tcx> for CheckNakedFunctions<'tcx> {
let fn_header;
match fk {
FnKind::Closure(..) => {
FnKind::Closure => {
// Closures with a naked attribute are rejected during attribute
// check. Don't validate them any further.
return;
@ -62,7 +62,8 @@ impl<'tcx> Visitor<'tcx> for CheckNakedFunctions<'tcx> {
}
}
let naked = fk.attrs().iter().any(|attr| attr.has_name(sym::naked));
let attrs = self.tcx.hir().attrs(hir_id);
let naked = attrs.iter().any(|attr| attr.has_name(sym::naked));
if naked {
let body = self.tcx.hir().body(body_id);
check_abi(self.tcx, hir_id, fn_header.abi, ident_span);