Skip to content
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

Add message on reusing previous temporary path on failed cargo installs #12231

Merged
merged 2 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add additional info on a new line
  • Loading branch information
MarcusGrass committed Jun 5, 2023
commit 03675ef6a4f8f2edad803063dfef41dd844dbb22
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl<'cfg, 'a> InstallablePackage<'cfg, 'a> {

format!(
"failed to compile `{}`, intermediate artifacts can be \
found at `{}`, to reuse those artifacts with a future \
found at `{}`.\nTo reuse those artifacts with a future \
compilation, set the environment variable \
`CARGO_TARGET_DIR` to that path.",
self.pkg,
Expand Down
8 changes: 5 additions & 3 deletions tests/testsuite/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ fn simple_install_fail() {
.with_status(101)
.with_stderr(
" Installing bar v0.1.0
error: failed to compile `bar v0.1.0`, intermediate artifacts can be found at `[..]`, \
to reuse those artifacts with a future compilation, set the environment variable \
error: failed to compile `bar v0.1.0`, intermediate artifacts can be found at `[..]`.
To reuse those artifacts with a future compilation, set the environment variable \
`CARGO_TARGET_DIR` to that path.

Caused by:
Expand Down Expand Up @@ -761,7 +761,9 @@ fn version_missing() {
.with_stderr(
"\
[INSTALLING] bar v0.1.0
error: failed to compile [..]
error: failed to compile [..], intermediate artifacts can be found at `[..]`.
To reuse those artifacts with a future compilation, set the environment variable \
`CARGO_TARGET_DIR` to that path.

Caused by:
failed to select a version for the requirement `foo = \"^2\"`
Expand Down
6 changes: 3 additions & 3 deletions tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ fn compile_failure() {
"\
[ERROR] could not compile `foo` (bin \"foo\") due to previous error
[ERROR] failed to compile `foo v0.0.1 ([..])`, intermediate artifacts can be \
found at `[..]target`, to reuse those artifacts with a future compilation, \
found at `[..]target`.\nTo reuse those artifacts with a future compilation, \
set the environment variable `CARGO_TARGET_DIR` to that path.
",
)
Expand Down Expand Up @@ -2266,7 +2266,7 @@ fn failed_install_retains_temp_directory() {
.unwrap();
compare::match_contains(
"error: failed to compile `foo v0.0.1`, intermediate artifacts can be found at \
`[..]`, to reuse those artifacts with a future compilation, set the environment \
`[..]`.\nTo reuse those artifacts with a future compilation, set the environment \
variable `CARGO_TARGET_DIR` to that path.",
&stderr,
None,
Expand All @@ -2275,7 +2275,7 @@ fn failed_install_retains_temp_directory() {

// Find the path in the output.
let start = stderr.find("found at `").unwrap() + 10;
let end = stderr[start..].find(',').unwrap() - 1;
let end = stderr[start..].find('.').unwrap() - 1;
let path = Path::new(&stderr[start..(end + start)]);
assert!(path.exists());
assert!(path.join("release/deps").exists());
Expand Down
7 changes: 4 additions & 3 deletions tests/testsuite/required_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,9 @@ Consider enabling some of the needed features by passing, e.g., `--features=\"a\
"\
[INSTALLING] foo v0.0.1 ([..])
[ERROR] failed to compile `foo v0.0.1 ([..])`, intermediate artifacts can be found at \
`[..]target`, to reuse those artifacts with a future compilation, set the environment \
variable `CARGO_TARGET_DIR` to that path.
`[..]target`.
To reuse those artifacts with a future compilation, set the environment \
variable `CARGO_TARGET_DIR` to that path.

Caused by:
target `foo` in package `foo` requires the features: `a`
Expand All @@ -679,7 +680,7 @@ Caused by:
"\
[INSTALLING] foo v0.0.1 ([..])
[ERROR] failed to compile `foo v0.0.1 ([..])`, intermediate artifacts can be found at \
`[..]target`, to reuse those artifacts with a future compilation, set the environment \
`[..]target`.\nTo reuse those artifacts with a future compilation, set the environment \
variable `CARGO_TARGET_DIR` to that path.

Caused by:
Expand Down