diff options
| author | Kalle Wachsmuth <kalle.wachsmuth@gmail.com> | 2024-02-20 00:14:53 +0100 |
|---|---|---|
| committer | Kalle Wachsmuth <kalle.wachsmuth@gmail.com> | 2024-02-20 00:14:53 +0100 |
| commit | dc7a01610f2a26dd1e1dadd136b20715909d6b94 (patch) | |
| tree | d9937ba0a40912f6c2edf7971bd4dde90171cf74 /compiler/rustc_lint/src | |
| parent | 3246e79513cb89ddbfc0f21cb5a877e5b321dcc5 (diff) | |
| download | rust-dc7a01610f2a26dd1e1dadd136b20715909d6b94.tar.gz rust-dc7a01610f2a26dd1e1dadd136b20715909d6b94.zip | |
trigger `unsafe_code` on `global_asm!` invocations
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/lints.rs | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index faa35f51cd4..f00177fde7c 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -393,6 +393,10 @@ impl EarlyLintPass for UnsafeCode { } } + ast::ItemKind::GlobalAsm(..) => { + self.report_unsafe(cx, it.span, BuiltinUnsafe::GlobalAsm); + } + _ => {} } } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index c204c67fc1f..7015d813390 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -114,6 +114,9 @@ pub enum BuiltinUnsafe { DeclUnsafeMethod, #[diag(lint_builtin_impl_unsafe_method)] ImplUnsafeMethod, + #[diag(lint_builtin_global_asm)] + #[note(lint_builtin_global_macro_unsafety)] + GlobalAsm, } #[derive(LintDiagnostic)] |
