Skip to content

Commit

Permalink
modules/rust: use 'nightly' as the bindgen version if the compiler is…
Browse files Browse the repository at this point in the history
… nightly

This adds tracking for both nightly and beta to the rust compiler.
  • Loading branch information
dcbaker committed Feb 26, 2025
1 parent 07e13fb commit 330c892
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mesonbuild/compilers/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoic
if 'link' in self.linker.id:
self.base_options.add(OptionKey('b_vscrt'))
self.native_static_libs: T.List[str] = []
self.is_beta = '-beta' in full_version
self.is_nightly = '-nightly' in full_version

def needs_static_linker(self) -> bool:
return False
Expand Down
5 changes: 4 additions & 1 deletion mesonbuild/modules/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
if T.TYPE_CHECKING:
from . import ModuleState
from ..build import IncludeDirs, LibTypes
from ..compilers.rust import RustCompiler
from ..dependencies import Dependency, ExternalLibrary
from ..interpreter import Interpreter
from ..interpreter import kwargs as _kwargs
Expand Down Expand Up @@ -58,12 +59,14 @@ class RustModule(ExtensionModule):
"""A module that holds helper functions for rust."""

INFO = ModuleInfo('rust', '0.57.0', stabilized='1.0.0')
_bindgen_rust_target: T.Optional[str]

def __init__(self, interpreter: Interpreter) -> None:
super().__init__(interpreter)
self._bindgen_bin: T.Optional[T.Union[ExternalProgram, Executable, OverrideProgram]] = None
if 'rust' in interpreter.compilers.host:
self._bindgen_rust_target: T.Optional[str] = interpreter.compilers.host['rust'].version
rustc = T.cast('RustCompiler', interpreter.compilers.host['rust'])
self._bindgen_rust_target = 'nightly' if rustc.is_nightly else rustc.version
else:
self._bindgen_rust_target = None
self._bindgen_set_std = False
Expand Down

0 comments on commit 330c892

Please sign in to comment.