Skip to content

Ensure discoverability of automatic garbage collection #13176

@matthieu-m

Description

@matthieu-m

Problem

Cache cleaning is coming to Cargo, which I am really excited about.

Ideally, it should (once mature) be opt-out: active by default, with reasonable defaults, unless a user configures it. But how is a new user ever supposed to know the feature exists and that it can be configured?

This may catch users unaware, wiping out their crate cache behind their back before they embark on a journey in which they wished to revive an old project while sitting in a train, plane, in a cabin in the woods, etc...

Proposed Solution

The GC feature should be discoverable, so that new users, even those who didn't read the documentation, or who forgot about it, are regularly reminded about its existence.

A potential solution would be to remind users of the feature... whenever the feature kicks in. According to the article:

When you run cargo, once a day it will inspect the last-use cache tracker, and determine if any cache elements have not been used in a while.

It would be very useful if at the very time automatic cleaning runs to determine what to clean, it would print:

  • Either a single line indicating there's nothing to clean.
  • Or, if it does clean anything, one line per crate/version that is cleaned.

Since this feedback is not time-sensitive, it would be fine -- should the cleaning run in the background -- to provide it on the next run of cargo after cleaning completes instead. It would still be only once a day, and it would still make the feature discoverable by new users.

Notes

Bottom of the reddit comment chain which inspired this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Z-gcNightly: garbage collection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions