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 😄

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants