windows_registry: add api which accepts just the target arch
Closed this issue · 2 comments
Currently rustc has to pass the actual value of the --target
argument to cc::windows_registry::find_tool
, making it one of the only places in rustc where the name of the target matters rather than the contents of the target. This also for example means that if you take the target spec of x86_64-pc-windows-msvc and put it in a file called aarch64-foo.json, rustc will incorrectly try to find a linker for aarch64. Or more realistically if you name it foo.json, rustc will not know which target to find a linker for even though the target spec itself contains the architecture to compile for.
Perhaps we could also change it to take either just the arch, or a full target triple? And then deprecate the former?
Maybe we should split that part into a separate crate?
I feel like it is not exactly part of cc, just put it in cc for convenience, and sometimes we might want to change its API.
If we are going to put it in a separate crate though, we probably want to do the same for other parts of cc-rs as well, which will also improve compile-time.