-
Notifications
You must be signed in to change notification settings - Fork 31
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
Delete incremental
directory
#50
Comments
My understanding is that rustc does a pretty good job of cleaning up files in that directory even across versions. I think that if there are files that are not reliably getting cleaned up that can be reported on the rust issue tracker mentioning incremental. I do know that Cargo has no tracking we can use about the files in that folder. Do you have a suggestion for how you would like to see that cleaned? |
With the My most used use-case for cargo sweep is a recursive I'm also not sure if the incremental directory really should automatically be cleaned by rustc, at least I don't think I've ever seen that happen. I deleted the huge ones manually before creating this issue, but looking through some older projects I can find a lot of redundant ones (likely from regular nightly toolchain updates): |
I think this is relevant: cargo ./target fills with outdated artifacts as toolchains are updated/changed #5026 Build files across toolchains are not automatically cleaned, and this includes the |
@Eh2406 I had to reverse engineer how cargo-sweep works from the code, so I might be wrong, but my understanding of how it works today is:
For example, if I pass The problem with Ok, assuming all that's true, I think my preferred solution is for cargo to start emitting those .json fingerprint files for incremental products. Is that doable? If not, can it at least include the hash of the compiler version in the incremental directory name? |
Your description of how cargo-sweep works sounds correct to my recollection. Sorry I left the code an undocumented mess. Fundamentally the incremental folder is not maintained by Cargo. The files are created by rustc, and usually cleaned up by rustc. I have no idea what structure rustc uses for organizing these files, or how we could introspect them to dell files that fell through the cracks. |
Ah, I see - cargo is only passing That's ... quite unfortunate. I suppose cargo could do something like |
It would be convenient if there was added some way for cargo-sweep to remove these, whether with --all (right now One workaround I got working is to run:
Edit: you might want to run this command without the |
Thanks, this was a good suggestion. However I found it was matching some files with 'incremental' in the name (surprisingly common) so here is my extra safe and verbose version:
Try a dry run, then add This reclaimed me another 30GB of space on top of |
cargo sweep -r path
leaves thetarget/<debug>/incremental
directory as-is, which can amass a lot of redundant builds. I would expect sweep to clean this directory too.The text was updated successfully, but these errors were encountered: