Auto merge of #9226 - matklad:utf8everywhere, r=alexcrichton
Don't panic when printing JSON with non-utf8 paths
Before:
λ cd \Xff/foo/ && cargo verify-project && cargo metadata
{"success":"true"}
warning: please specify `--format-version` flag explicitly to avoid compatibility problems
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("path contains invalid UTF-8 characters", line: 0, column: 0)', /rustc/
a5a775e3f9e8043dad405e00aee0ae60882a7b71/src/tools/cargo/src/cargo/core/shell.rs:346:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
After:
λ cd \Xff/foo/ && $cargo verify-project && $cargo metadata
{"success":"true"}
warning: please specify `--format-version` flag explicitly to avoid compatibility problems
error: path contains invalid UTF-8 characters
I am pretty sure that this has zero real-world impact, but the diff is
small, so why not handle it?