-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
try go fix cargo fmt invocation #4620
Conversation
@bors try |
try go fix cargo fmt invocation changelog: none
💔 Test failed - status-appveyor |
Hm, apparently |
@@ -1,3 +1,4 @@ | |||
use home; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this in 2018 edition
use home; |
// because we will end up with cargo --foo +nightly fmt but the "+nightly" needs to come first | ||
// get the absolute path to the cargo binary inside $CARGO_HOME | ||
let cargo_home = home::cargo_home().expect("failed to get cargo home path!"); | ||
let cargo_path = cargo_home.join("bin").join("cargo"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let cargo_path = cargo_home.join("bin").join("cargo"); | |
let cargo_path = cargo_home.join("bin").join(format!("cargo{}", std::env::consts::EXE_SUFFIX)); |
The issue turned out to be a cargo bug: rust-lang/cargo#7475 |
Use absolute path $CARGO_HOME/bin/cargo to get cargo path in rustfmt tests.
I get the same error as this is supposed to fix on my system because I have an alias
cargo="cargo --foo
on my system.This causes
cargo +nightly check
to be resolved tocargo --foo +nightly check
which is wrong because the+nightly
needs to be the first arg!Work around by circumventing possible aliasing and using the absolute path to the cargo binary.
changelog: none