Add checking for no_mangle to unsafe_code lint
This commit is contained in:
parent
85fbf49ce0
commit
06a0269c11
3 changed files with 80 additions and 24 deletions
|
@ -277,6 +277,22 @@ impl EarlyLintPass for UnsafeCode {
|
|||
})
|
||||
}
|
||||
|
||||
ast::ItemKind::Fn(..) => {
|
||||
if attr::contains_name(&it.attrs, sym::no_mangle) {
|
||||
self.report_unsafe(cx, it.span, |lint| {
|
||||
lint.build("declaration of a `no_mangle` function").emit();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
ast::ItemKind::Static(..) => {
|
||||
if attr::contains_name(&it.attrs, sym::no_mangle) {
|
||||
self.report_unsafe(cx, it.span, |lint| {
|
||||
lint.build("declaration of a `no_mangle` static").emit();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue