diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-08-11 13:16:17 +0200 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-08-17 10:42:52 -0400 |
| commit | 97c4e9dea6ccc7772651533dc2afaf0fa43aca84 (patch) | |
| tree | 7b8ee51474e0a87fe4e4b1ffc1b7958dd09a32e1 /mesonbuild/backend | |
| parent | 14b76321c3f528e95384f7ea5f238ccd1340df3d (diff) | |
| download | meson-97c4e9dea6ccc7772651533dc2afaf0fa43aca84.tar.gz | |
ninjabackend: pass objects to doctests
Fix my misunderstanding of the code before commit aede231ef ("ninjabackend:
pass objects to generate_rust_target from non-Rust sources", 2025-07-29).
Object files were added by get_rust_compiler_deps_and_args() to both the
main target and the doctest command lines:
objs, od = self.flatten_object_list(target)
for o in objs:
args.append(f'-Clink-arg={o}')
deps.append(o)
therefore they now need to be passed as the final argument of
get_rust_compiler_deps_and_args() for both command lines as well.
Failure to do so causes problems building doctests when the main
target has objects as well.
Add a regression test as well.
Fixes: #14897
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/backend')
| -rw-r--r-- | mesonbuild/backend/ninjabackend.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 595a27a05..76f16069e 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2208,10 +2208,9 @@ class NinjaBackend(backends.Backend): rustdoc = rustc.get_rustdoc(self.environment) args = rustdoc.get_exe_args() args += self.get_rust_compiler_args(target.doctests.target, rustdoc, target.rust_crate_type) - # There can be no non-Rust objects: the doctests are gathered from Rust - # sources and the tests are linked with the target (which is where the - # obj_list was linked into) - _, _, deps_args = self.get_rust_compiler_deps_and_args(target.doctests.target, rustdoc, []) + # Rustc does not add files in the obj_list to Rust rlibs, + # and is added by Meson to all of the dependencies, including here. + _, _, deps_args = self.get_rust_compiler_deps_and_args(target.doctests.target, rustdoc, obj_list) args += deps_args target.doctests.cmd_args = args.to_native() + [main_rust_file] + target.doctests.cmd_args |
