cargo clean: Add target directory validation#16712
cargo clean: Add target directory validation#16712TanmayArya-1p wants to merge 2 commits intorust-lang:masterfrom
Conversation
|
I also noticed that if a file path is passed via |
|
r? @weihanglo rustbot has assigned @weihanglo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
94c1489 to
94a4d66
Compare
|
thanks for the review :) Also I noticed that the CI keeps failing in something totally unrelated. I see it's happening in other PRs as well. Any idea why this is happening? |
Feel free to rebase onto master! |
94a4d66 to
c6cdaa1
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
c6cdaa1 to
f72fbd1
Compare
f72fbd1 to
23c225b
Compare
|
Added a check(and test) to make sure |
This comment was marked as duplicate.
This comment was marked as duplicate.
1 similar comment
|
I knew we discussed this during a meeting last year, but for a behavior change it is still better to have a formal record and give members time to think about it offline. Hence @rfcbot fcp merge cargo This implements the target-dir validation described in #9192 (comment).
This also adds an extra validation that if target-dir points to a file, errors out. |
|
Team member @weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
From #9192 (comment)
What led to deciding in the direction of the future-incompat warning? |
For myself, to be conservative. I remembered rust-analyzer may create target-dir before running any |
What does this PR try to resolve?
Fixes #9192
Implements the checks mentioned in this comment
To summarise, when
cargo cleanis run with a specified target directory:--target-dir: check if a validCACHEDIR.TAGexists in the target directory and hard error otherwise.CACHEDIR.TAGTests
I've added 3 sets of unit tests for:
--target-diris used explicitlyCARGO_TARGET_DIRenv variableLet me know if there is a case I've missed or if i need to merge multiple tests into a single one.