Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: avoid warnings from rust.test #13919

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mesonbuild/modules/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ def test(self, state: ModuleState, args: T.Tuple[str, BuildTarget], kwargs: Func
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']
Expand Down
4 changes: 2 additions & 2 deletions test cases/rust/9 unit tests/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('rust unit tests', 'rust')
project('rust unit tests', 'rust', meson_version: '>=1.2.0')

t = executable(
'rust_test',
Expand Down Expand Up @@ -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')
Expand Down
7 changes: 7 additions & 0 deletions unittests/allplatformstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4890,6 +4890,13 @@ def test_rust_clippy(self) -> None:
self.assertTrue('error: use of a blacklisted/placeholder name `foo`' in cm.exception.stdout or
'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:
Expand Down
Loading