diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-12-02 16:02:03 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-01-04 12:20:39 -0800 |
commit | fe973d9fc45581f20fefc41fc0b8eb0066c0129d (patch) | |
tree | cbf7f5bd779ddae1655c9644ef96c4df66e67ee3 /mesonbuild/compilers/rust.py | |
parent | bdca05e2e66abbd872c17b8226641a2b8d018112 (diff) | |
download | meson-fe973d9fc45581f20fefc41fc0b8eb0066c0129d.zip meson-fe973d9fc45581f20fefc41fc0b8eb0066c0129d.tar.gz meson-fe973d9fc45581f20fefc41fc0b8eb0066c0129d.tar.bz2 |
use OptionKey for compiler_options
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r-- | mesonbuild/compilers/rust.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 312b3b6..cf1af0a 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -17,11 +17,12 @@ import textwrap import typing as T from .. import coredata +from ..coredata import OptionKey from ..mesonlib import EnvironmentException, MachineChoice, MesonException, Popen_safe from .compilers import Compiler, rust_buildtype_args, clike_debug_args if T.TYPE_CHECKING: - from ..coredata import OptionDictType + from ..coredata import KeyedOptionDictType from ..dependencies import ExternalProgram from ..envconfig import MachineInfo from ..environment import Environment # noqa: F401 @@ -133,18 +134,20 @@ class RustCompiler(Compiler): # C compiler for dynamic linking, as such we invoke the C compiler's # use_linker_args method instead. - def get_options(self) -> 'OptionDictType': + def get_options(self) -> 'KeyedOptionDictType': + key = OptionKey('std', machine=self.for_machine, lang=self.language) return { - 'std': coredata.UserComboOption( + key: coredata.UserComboOption( 'Rust Eddition to use', ['none', '2015', '2018'], 'none', ), } - def get_option_compile_args(self, options: 'OptionDictType') -> T.List[str]: + def get_option_compile_args(self, options: 'KeyedOptionDictType') -> T.List[str]: args = [] - std = options['std'] + key = OptionKey('std', machine=self.for_machine, lang=self.language) + std = options[key] if std.value != 'none': args.append('--edition=' + std.value) return args |