rust: override get_linker_always_args

instead of opencoding what should be there in the rust compile rule
pull/8782/head
Dylan Baker 4 years ago committed by Jussi Pakkanen
parent 189545c2a8
commit b1b8e777a2
  1. 3
      mesonbuild/backend/ninjabackend.py
  2. 6
      mesonbuild/compilers/rust.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)

@ -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

Loading…
Cancel
Save