Description
Problem
So I was setting up a customized rustc, stepping outside the bounds of rustup toolchains, and I got an error invoking rustc when running Cargo. I fix the error, then re-run, and immediately get the same error. I run strace to see if I can spot the problem, and I see the error message printed, but no system call to run rustc. I was going crazy!
I finally traced this to src/cargo/util/rustc.rs::cached_output()
:
if self.data.outputs.contains_key(&key) {
debug!("rustc info cache hit");
} else {
// run command
}
let output: &Output = &self.data.outputs[&key];
if output.success {
Ok((output.stdout.clone(), output.stderr.clone()))
} else {
Err(ProcessError::new_raw(
msg: &format!("process didn't exit successfully: {}", cmd),
output.code,
&output.status,
stdout: Some(output.stdout.as_ref()),
stderr: Some(output.stderr.as_ref()),
) ProcessError
.into())
}
After I removed the .rustc_info.json cache file, my cargo invocation worked. So long story short, considering that command caches are imperfect, it should not cache failures, to give the user the best chance of fixing the problem.
I also think if a cached result is used, it should append a (cached) to the standard output, because the cache is imperfect, and this might be a vital clue if something is not being rebuilt when the user expects it to be.
Steps
No response
Possible Solution(s)
No response
Notes
No response
Version