Provide assistance in uninstalling unused toolchains, i.e. toolchain garbage collection
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 22h 40m
- Merged PRs (30d)
- 46
Description
Problem you are trying to solve
People who work on projects using pinned nightly (nightly-DDDD-MM-YY) or stable (1.XX.0) channels, or who perform bisection on toolchain bugs, may end up with many toolchains installed. It would be useful to help those users know when they can remove no-longer-used toolchains and reclaim disk space.
Solution you'd like
Whenever rustup runs a toolchain binary, update a “last used” timestamp for that toolchain (this could be as simple as touching a file kept with the toolchain, and could be kept at a coarse granularity of 1 day to reduce the cost of writes). Add the following UI features using this data:
- In
rustup toolchain list, include last used dates. - Add a command which may be run to uninstall all toolchains that have not been used recently.
- Whenever a new toolchain is manually or automatically installed, check how many old toolchains are installed and tell the user if there are a lot (perhaps with configurable thresholds).
- Optionally, automatically uninstall old toolchains to keep the count or age under configured limits.
(Another thing that would help is searching all rust-toolchain.toml files currently present for what channels they request, but that would either be costly or require integration with platform-specific filesystem search systems, so I do not recommend spending effort on this feature unless someone thinks it would be easy.)
Notes
I feel like this is obvious enough that it surely must have been suggested already, but I can't find any issue about it, using keywords like "automatically uninstall" and "toolchain garbage collection”. I apologize if this turns out to be a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by examining the existing rustup toolchain list, installation, and uninstall command entry points, then determine how toolchain execution can record usage. Done should be a maintainer-agreed scope covering timestamps, listing, cleanup behavior, and any installation warnings or configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100