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
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);
}
}
_ => {}
}
}