From d075bdb3ca39a077994fa65e7fafb98cdebf5da6 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 12 Jun 2023 20:46:33 -0400 Subject: [PATCH] cargo: Use coredata.stable_version This avoids generated code print warnings when using features introduced in current dev cycle. --- mesonbuild/cargo/interpreter.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mesonbuild/cargo/interpreter.py b/mesonbuild/cargo/interpreter.py index 66e45acc1..c5791ae4c 100644 --- a/mesonbuild/cargo/interpreter.py +++ b/mesonbuild/cargo/interpreter.py @@ -348,12 +348,11 @@ def _dependency_varname(package_name: str) -> str: return f'{fixup_meson_varname(package_name)}_dep' -def _create_project(cargo: Manifest, build: builder.Builder, env: Environment) -> T.List[mparser.BaseNode]: +def _create_project(cargo: Manifest, build: builder.Builder) -> T.List[mparser.BaseNode]: """Create a function call :param cargo: The Manifest to generate from :param build: The AST builder - :param env: Meson environment :return: a list nodes """ args: T.List[mparser.BaseNode] = [] @@ -366,7 +365,7 @@ def _create_project(cargo: Manifest, build: builder.Builder, env: Environment) - # Always assume that the generated meson is using the latest features # This will warn when when we generate deprecated code, which is helpful # for the upkeep of the module - 'meson_version': build.string(f'>= {env.coredata.version}'), + 'meson_version': build.string(f'>= {coredata.stable_version}'), 'default_options': build.array([build.string(f'rust_std={cargo.package.edition}')]), } if cargo.package.license: @@ -462,7 +461,7 @@ def interpret(subp_name: str, subdir: str, env: Environment) -> mparser.CodeBloc filename = os.path.join(cargo.subdir, cargo.path, 'Cargo.toml') build = builder.Builder(filename) - ast = _create_project(cargo, build, env) + ast = _create_project(cargo, build) ast += [build.assign(build.function('import', [build.string('rust')]), 'rust')] ast += _create_dependencies(cargo, build)