Skip to content

Conversation

@epage
Copy link
Contributor

@epage epage commented Nov 25, 2025

What does this PR try to resolve?

When we have limited content do remove, we were cleaning in an inner loop and left off the host layout.

How to test and review this PR?

This is a follow up to #15947 that I noticed when looking at #16264.

@rustbot rustbot added Command-clean S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 25, 2025

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@epage
Copy link
Contributor Author

epage commented Nov 25, 2025

CC @ranger-ross

let pkg_dir = format!("{}-*", pkg.name());
clean_ctx.progress.on_cleaning_package(&pkg.name())?;

if clean_ctx.gctx.cli_unstable().build_dir_new_layout {
Copy link
Member

Choose a reason for hiding this comment

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

Should we have tests for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I duplicated clean.rs tests to verify -Zbuild-dir-new-layout. This uncovered several issues. I fixed most. There remains one which has test overlap with this so no test results changed. I decided to go ahead and get this update up rather than wait on all of them since this last one may be a bit nasty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened #16302 for this

Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

Thanks!

Though I feel like the function is already complicated enough that we may want to separate old and new layout. Also, the extracted function should have comment telling that what it is going to clean. It is a bit annoying to trace the actual files getting removed.

View changes since this review

@weihanglo weihanglo added this pull request to the merge queue Nov 26, 2025
@ranger-ross
Copy link
Member

Though I feel like the function is already complicated enough that we may want to separate old and new layout. Also, the extracted function should have comment telling that what it is going to clean. It is a bit annoying to trace the actual files getting removed.

Agreed, I am hoping the new layout will reduce the amount of code needed for clean.

Comment on lines +223 to +225
let artifact_dir = layout
.artifact_dir()
.expect("artifact-dir was not locked during clean");
Copy link
Member

Choose a reason for hiding this comment

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

I think we can't merge this until we un-revert #16299

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How come? Without that, artifact_dir() should always be Some

Copy link
Member

Choose a reason for hiding this comment

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

Err nvm, I forgot we split that into 2 PRs

@epage
Copy link
Contributor Author

epage commented Nov 26, 2025

Depending on how short-lived it is, it is likely better to keep as one function, especially if #16264 moves forward as that will have a lot of shared code.

Merged via the queue into rust-lang:master with commit 23f5b2b Nov 26, 2025
46 of 52 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 26, 2025
@epage epage deleted the clean branch November 26, 2025 16:21
github-merge-queue bot pushed a commit that referenced this pull request Nov 28, 2025
### What does this PR try to resolve?

A follow up to #16300.

This doesn't split out any functions
- The stuff before hand is quite significant
- For #16264, we made add more before and some after
- We could pull out only the branches of the `if` into functions but
then we'd just move them back when this is done and seems like extra
churn

### How to test and review this PR?
bors added a commit to rust-lang/rust that referenced this pull request Dec 3, 2025
Update cargo submodule

14 commits in 2a7c4960677971f88458b0f8b461a866836dff59..bd979347d814dfe03bba124165dbce9554d0b4d8
2025-11-25 19:58:07 +0000 to 2025-12-02 16:03:50 +0000
- fix(completion): Put host-tuple before actual tuples (rust-lang/cargo#16327)
- fix(lints): use plural form correctly (rust-lang/cargo#16324)
- fix(completions): include `all` in `cargo tree --target` candidates (rust-lang/cargo#16322)
- fix(lints): show lint error number (rust-lang/cargo#16320)
- chore(deps): update compatible (rust-lang/cargo#16318)
- chore(deps): update crate-ci/typos action to v1.40.0 (rust-lang/cargo#16316)
- Do not lock the artifact-dir for check builds + fix uplifting (rust-lang/cargo#16307)
- Properly validate crate names in `cargo install` (rust-lang/cargo#16314)
- Support --filter-platform=host for cargo metadata rust-lang/cargo#9423 (rust-lang/cargo#16312)
- Update to mdbook 0.5 (rust-lang/cargo#16292)
- refactor(clean): Better divide old / new layout (rust-lang/cargo#16304)
- update: silent failure on non-matching package specs with --breaking (rust-lang/cargo#16276)
- fix(log): break timing-info message to multiple (rust-lang/cargo#16303)
- fix(clean): Clean hosts builds with new layout (rust-lang/cargo#16300)
@rustbot rustbot added this to the 1.93.0 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants