about summary refs log tree commit diff
path: root/compiler/rustc_passes/src/errors.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-11-23 20:19:51 +0800
committerGitHub <noreply@github.com>2024-11-23 20:19:51 +0800
commitc6d36256a6e6b7263eef2fa3f5aafef07768ac99 (patch)
tree04ac9ad89a2d29b85e43271187de4c34b81d9e6a /compiler/rustc_passes/src/errors.rs
parent6e1c11591fc7e98015f8e793a15c8faf0bda67f1 (diff)
parent204b2281fa508cf512d343cb1631955a5dfa9e0e (diff)
downloadrust-c6d36256a6e6b7263eef2fa3f5aafef07768ac99.tar.gz
rust-c6d36256a6e6b7263eef2fa3f5aafef07768ac99.zip
Rollup merge of #127483 - BertalanD:no_sanitize-global-var, r=rcvalle
Allow disabling ASan instrumentation for globals

AddressSanitizer adds instrumentation to global variables unless the [`no_sanitize_address`](https://llvm.org/docs/LangRef.html#global-attributes) attribute is set on them.

This commit extends the existing `#[no_sanitize(address)]` attribute to set this; previously it only had the desired effect on functions.

(cc https://github.com/rust-lang/rust/issues/39699)
Diffstat (limited to 'compiler/rustc_passes/src/errors.rs')
-rw-r--r--compiler/rustc_passes/src/errors.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs
index 2d1734c0314..fbf25cb476a 100644
--- a/compiler/rustc_passes/src/errors.rs
+++ b/compiler/rustc_passes/src/errors.rs
@@ -1846,3 +1846,14 @@ pub(crate) struct AttrCrateLevelOnlySugg {
     #[primary_span]
     pub attr: Span,
 }
+
+#[derive(Diagnostic)]
+#[diag(passes_no_sanitize)]
+pub(crate) struct NoSanitize<'a> {
+    #[primary_span]
+    pub attr_span: Span,
+    #[label]
+    pub defn_span: Span,
+    pub accepted_kind: &'a str,
+    pub attr_str: &'a str,
+}