summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-11-18 12:16:19 +0100
committerDylan Baker <dylan@pnwbakers.com>2024-11-19 12:08:57 -0800
commit110e2de4fa76da9c2bb7fe7b2008ac859564dbd3 (patch)
tree868fbe8512627cf3388697507dce3fd32749aaa5
parent93f59313e10090bfe6058fabbb235aa549f933c0 (diff)
downloadmeson-110e2de4fa76da9c2bb7fe7b2008ac859564dbd3.tar.gz
rust: avoid warnings from rust.test
Any argument from the base target is copied to the test target, but some keyword arguments for libraries are not available in executable. Remove them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/modules/rust.py3
-rw-r--r--test cases/rust/9 unit tests/meson.build4
-rw-r--r--unittests/allplatformstests.py7
3 files changed, 12 insertions, 2 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index 1368c4c19..60a58698c 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -162,6 +162,9 @@ class RustModule(ExtensionModule):
new_target_kwargs['dependencies'] = new_target_kwargs.get('dependencies', []) + kwargs['dependencies']
new_target_kwargs['link_with'] = new_target_kwargs.get('link_with', []) + kwargs['link_with']
del new_target_kwargs['rust_crate_type']
+ for kw in ['pic', 'prelink', 'rust_abi', 'version', 'soversion', 'darwin_versions']:
+ if kw in new_target_kwargs:
+ del new_target_kwargs[kw]
lang_args = base_target.extra_args.copy()
lang_args['rust'] = base_target.extra_args['rust'] + kwargs['rust_args'] + ['--test']
diff --git a/test cases/rust/9 unit tests/meson.build b/test cases/rust/9 unit tests/meson.build
index b444271ae..e62745781 100644
--- a/test cases/rust/9 unit tests/meson.build
+++ b/test cases/rust/9 unit tests/meson.build
@@ -1,4 +1,4 @@
-project('rust unit tests', 'rust')
+project('rust unit tests', 'rust', meson_version: '>=1.2.0')
t = executable(
'rust_test',
@@ -33,7 +33,7 @@ test(
exe = executable('rust_exe', ['test2.rs', 'test.rs'], build_by_default : false)
-rust = import('unstable-rust')
+rust = import('rust')
rust.test('rust_test_from_exe', exe, should_fail : true)
lib = static_library('rust_static', ['test.rs'], build_by_default : false, rust_crate_type : 'lib')
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index f4434bb9f..b6a87af1f 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -4891,6 +4891,13 @@ class AllPlatformTests(BasePlatformTests):
'error: use of a disallowed/placeholder name `foo`' in cm.exception.stdout)
@skip_if_not_language('rust')
+ def test_rust_test_warnings(self) -> None:
+ if self.backend is not Backend.ninja:
+ raise unittest.SkipTest('Rust is only supported with ninja currently')
+ testdir = os.path.join(self.rust_test_dir, '9 unit tests')
+ self.init(testdir, extra_args=['--fatal-meson-warnings'])
+
+ @skip_if_not_language('rust')
def test_rust_rlib_linkage(self) -> None:
if self.backend is not Backend.ninja:
raise unittest.SkipTest('Rust is only supported with ninja currently')