Add checking for export_name to unsafe_code lint

This commit is contained in:
Wim Looman 2020-05-15 17:36:19 +02:00
parent 06a0269c11
commit 66b2f9acfc
3 changed files with 71 additions and 19 deletions

View file

@ -283,6 +283,11 @@ impl EarlyLintPass for UnsafeCode {
lint.build("declaration of a `no_mangle` function").emit();
})
}
if attr::contains_name(&it.attrs, sym::export_name) {
self.report_unsafe(cx, it.span, |lint| {
lint.build("declaration of a function with `export_name`").emit();
})
}
}
ast::ItemKind::Static(..) => {
@ -291,6 +296,11 @@ impl EarlyLintPass for UnsafeCode {
lint.build("declaration of a `no_mangle` static").emit();
})
}
if attr::contains_name(&it.attrs, sym::export_name) {
self.report_unsafe(cx, it.span, |lint| {
lint.build("declaration of a static with `export_name`").emit();
})
}
}
_ => {}