Fire unsafe_code lint on unsafe extern blocks

This commit is contained in:
Santiago Pastorino 2024-07-09 17:35:51 -03:00
parent c3774be741
commit a3ef94e80e
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
5 changed files with 41 additions and 0 deletions

View file

@ -326,6 +326,12 @@ impl EarlyLintPass for UnsafeCode {
self.report_unsafe(cx, it.span, BuiltinUnsafe::GlobalAsm);
}
ast::ItemKind::ForeignMod(ForeignMod { safety, .. }) => {
if let Safety::Unsafe(_) = safety {
self.report_unsafe(cx, it.span, BuiltinUnsafe::UnsafeExternBlock);
}
}
_ => {}
}
}