1
Fork 0

Rollup merge of #127535 - spastorino:unsafe_code-unsafe_extern_blocks, r=oli-obk

Fire unsafe_code lint on unsafe extern blocks

Fixes #126738
This commit is contained in:
Jubilee 2024-07-12 13:47:08 -07:00 committed by GitHub
commit 2e0591b1e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 0 deletions

View file

@ -325,6 +325,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);
}
}
_ => {}
}
}