Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ShoyuVanilla
Copy link
Member

@ShoyuVanilla ShoyuVanilla commented Oct 27, 2025

Fixes #20821

Currently, there are some buggy situations:

  1. When rust-analyzer.cargo.targetDir is set to null, flycheck output files are written to the target/, even if target-dir is set otherwise either with env vars or config files.
  2. When rust-analyzer.cargo.targetDir is set to true, and $CARGO_TARGET_DIR is unset, rust-analyzer's flycheck artifacts are written in target/rust-analyzer, even if the target-dir is set otherwise either with $CARGO_BUILD_TARGET_DIR or cargo config file.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 27, 2025
locked: bool,
progress: &dyn Fn(String),
) -> anyhow::Result<(cargo_metadata::Metadata, Option<anyhow::Error>)> {
_ = target_dir;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting this single line resulted in deleting/simplifying extra dozens of lines πŸ˜„

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it this is a remnant of us copying the lock file to the target directory?

@ShoyuVanilla ShoyuVanilla marked this pull request as draft October 27, 2025 20:03
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 27, 2025
@ShoyuVanilla
Copy link
Member Author

I'm gonna test this with more configurations

@ShoyuVanilla
Copy link
Member Author

Okay, this works fine except it doesn't fix the original issue when there are linked projects and rust-analyzer.cargo.targetDir is set to a path string. Fixing it is very simple

@ShoyuVanilla ShoyuVanilla marked this pull request as ready for review October 28, 2025 06:51
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 28, 2025
@Veykril
Copy link
Member

Veykril commented Nov 1, 2025

Is this ready to merge or are the comments still applicable? Would love to get this in before the next release

@ShoyuVanilla
Copy link
Member Author

Yeah, this is ready to be merged

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Nov 2, 2025
Merged via the queue into rust-lang:master with commit bacc5bb Nov 2, 2025
15 checks passed
@ShoyuVanilla ShoyuVanilla deleted the target-dirs branch November 2, 2025 05:26
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust Analyzer writes target/rust-analyzer/flycheck in wrong directory

3 participants