Open
Description
@wycats, @nikomatsakis and I have discussed recently the ability to yank a crate with a reason, and then whenever that yanked crate is compiled locally it will present the reason as a warning.
The intended use cases for this would be:
- When a crate is fixed because it will be broken in the next version of the compiler (e.g. a soundness fix or bug fix) then the previous versions can be yanked and nudge users forward.
- If a crate is fixed for a security reason, the old versions can be yanked and the new version can be suggested
- If a crate is renamed (or perhaps deprecated) to another then the yank message can indicate what to do in that situation.
Technically, I believe this should be implemented through:
- Update crates.io to accept an optional message for yanks. Store it in the database.
- Update
cargo yank
to require a message indicating why the crate is being yanked. - Change the logic for when a yanked crate is compiled to something like:
- Use whatever state the registry is currently in, do not update it.
- Only issue a warning if the crate is compiled, not if it is "fresh" (e.g. has already been compiled).
- When compilation starts, fire off an asynchronous HTTP request to crates.io to fetch the yank message.
- Print out the warning whenever the HTTP request finishes or block the build finishing on these HTTP requests to return.
- Ignore any errors that happen fetching the yank message, they should not fail the build.
I think this should suffice as an "opportunistic nudge" for these situations where possible, although it's certainly no form of ironclad guarantee.
Thoughts @wycats, @nikomatsakis?