mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
refactor: reuse error_missing_print_output
on similar errors
This commit is contained in:
parent
036ed3a2dd
commit
1cef6d7675
@ -219,13 +219,8 @@ impl TargetInfo {
|
|||||||
map.insert(crate_type.clone(), out);
|
map.insert(crate_type.clone(), out);
|
||||||
}
|
}
|
||||||
|
|
||||||
let line = match lines.next() {
|
let Some(line) = lines.next() else {
|
||||||
Some(line) => line,
|
return error_missing_print_output("sysroot", &process, &output, &error);
|
||||||
None => anyhow::bail!(
|
|
||||||
"output of --print=sysroot missing when learning about \
|
|
||||||
target-specific information from rustc\n{}",
|
|
||||||
output_err_info(&process, &output, &error)
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
let sysroot = PathBuf::from(line);
|
let sysroot = PathBuf::from(line);
|
||||||
let sysroot_host_libdir = if cfg!(windows) {
|
let sysroot_host_libdir = if cfg!(windows) {
|
||||||
@ -601,12 +596,8 @@ fn parse_crate_type(
|
|||||||
};
|
};
|
||||||
let mut parts = line.trim().split("___");
|
let mut parts = line.trim().split("___");
|
||||||
let prefix = parts.next().unwrap();
|
let prefix = parts.next().unwrap();
|
||||||
let suffix = match parts.next() {
|
let Some(suffix) = parts.next() else {
|
||||||
Some(part) => part,
|
return error_missing_print_output("file-names", cmd, output, error);
|
||||||
None => anyhow::bail!(
|
|
||||||
"output of --print=file-names has changed in the compiler, cannot parse\n{}",
|
|
||||||
output_err_info(cmd, output, error)
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Some((prefix.to_string(), suffix.to_string())))
|
Ok(Some((prefix.to_string(), suffix.to_string())))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user