Function rustc_host::from_cli
source · pub fn from_cli() -> Result<String, Error>
Expand description
Returns the host triple of the current rustc using CLI.
Notice that such implementation relies on presence of rustc
on the machine
where this function is called. However, it can be ran in a build script.
Implementation details
At the moment of writing, it relies on the output of rustc -vV
, which is expected to be
nearly in the following format:
rustc 1.66.0 (69f9c33d7 2022-12-12)
binary: rustc
commit-hash: 69f9c33d71c871fc16ac445211281c6e7a340943
commit-date: 2022-12-12
host: x86_64-pc-windows-msvc
release: 1.66.0
LLVM version: 15.0.2
To be precise, it expects a line starting with host:
.