diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-11-08 12:06:45 +0100 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-11-12 14:56:22 -0800 |
| commit | b207b2744ae90fb9c599b534e10ecf39f50c9b2c (patch) | |
| tree | 0216584d5d4d7def4064b3ca9651fc37cf4ef0f4 /mesonbuild | |
| parent | 375154f964d14bde4982a15659fe2df81b571261 (diff) | |
| download | meson-b207b2744ae90fb9c599b534e10ecf39f50c9b2c.tar.gz | |
rust: allow linking with sanitizer-enabled C libraries
Fixes: #15222
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild')
| -rw-r--r-- | mesonbuild/compilers/rust.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 73c38148b..16700ad37 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -213,6 +213,22 @@ class RustCompiler(Compiler): def get_crt_static(self) -> bool: return 'target_feature="crt-static"' in self.get_cfgs() + def get_nightly(self, target: T.Optional[BuildTarget], env: Environment) -> bool: + if not target: + return self.allow_nightly + key = self.form_compileropt_key('nightly') + nightly_opt = env.coredata.get_option_for_target(target, key) + if nightly_opt == 'enabled' and not self.is_nightly: + raise EnvironmentException(f'Rust compiler {self.name_string()} is not a nightly compiler as required by the "nightly" option.') + return nightly_opt != 'disabled' and self.is_nightly + + def sanitizer_link_args(self, target: T.Optional[BuildTarget], env: Environment, value: T.List[str]) -> T.List[str]: + # Sanitizers are not supported yet for Rust code. Nightly supports that + # with -Zsanitizer=, but procedural macros cannot use them. But even if + # Rust code cannot be instrumented, we can link in the sanitizer libraries + # for the sake of C/C++ code + return rustc_link_args(super().sanitizer_link_args(target, env, value)) + @functools.lru_cache(maxsize=None) def has_verbatim(self) -> bool: if version_compare(self.version, '< 1.67.0'): |
