Add checking for export_name to unsafe_code lint
This commit is contained in:
parent
06a0269c11
commit
66b2f9acfc
3 changed files with 71 additions and 19 deletions
|
@ -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();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
_ => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue