summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/rust.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-05-12 09:11:36 +0200
committerDylan Baker <dylan@pnwbakers.com>2025-05-13 11:52:07 -0700
commit14010f4dfdb9847944592149b189184ab59b6de0 (patch)
tree13438fcbb181882a873f5b5f50ee56fa6a5a0bc4 /mesonbuild/modules/rust.py
parentc3beaa9a35622987df522d10f8584b4e8cbfe05d (diff)
downloadmeson-14010f4dfdb9847944592149b189184ab59b6de0.tar.gz
rust: skip doctests when build machine cannot run host binaries
"rustdoc --test" relies on running host binaries, and has no way of wrapping them with Meson's exe_wrapper. Just skip the doctests in that case. Fixes: #14583 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/modules/rust.py')
-rw-r--r--mesonbuild/modules/rust.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index f43a0ede9..c5f18e8e5 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -242,6 +242,10 @@ class RustModule(ExtensionModule):
def doctest(self, state: ModuleState, args: T.Tuple[str, T.Union[SharedLibrary, StaticLibrary]], kwargs: FuncDoctest) -> ModuleReturnValue:
name, base_target = args
+ if state.environment.is_cross_build() and state.environment.need_exe_wrapper(base_target.for_machine):
+ mlog.notice('skipping Rust doctests due to cross compilation', once=True)
+ return ModuleReturnValue(None, [])
+
# Link the base target's crate into the tests
kwargs['link_with'].append(base_target)
kwargs['depends'].append(base_target)