-
Couldn't load subscription status.
- Fork 984
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.