diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 3749ff779..c2ce827ce 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1582,8 +1582,7 @@ int dummy; # Rust is super annoying, calling -C link-arg foo does not work, it has # to be -C link-arg=foo if cratetype in {'bin', 'dylib'}: - for a in rustc.linker.get_always_args(): - args += ['-C', f'link-arg={a}'] + args.extend(rustc.get_linker_always_args()) opt_proxy = self.get_compiler_options_for_target(target) diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 285d49092..6a7bd04ff 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -162,3 +162,9 @@ class RustCompiler(Compiler): if colortype in {'always', 'never', 'auto'}: return [f'--color={colortype}'] raise MesonException(f'Invalid color type for rust {colortype}') + + def get_linker_always_args(self) -> T.List[str]: + args: T.List[str] = [] + for a in super().get_linker_always_args(): + args.extend(['-C', f'link-arg={a}']) + return args