cargo-semver-checks
cargo-semver-checks copied to clipboard
The tool fails when generating rustdoc of a yanked release from registry
I believe that the tool will fail when it'll try to generate rustdoc of a yanked release from registry. Basically cargo
(correctly) refuses to use a yanked release of a crate, unless there is a Cargo.lock
with it (but that requires manually creating this file, which probably is too much effort compared to the reward).
The https://github.com/obi1kenobi/cargo-semver-checks/pull/255 makes it so that yanked releases aren't chosen, unless there are no "normal" releases. We think that when there are only non-normal releases, the tool will possibly try to pick a yanked one, which will result in an error during rustdoc generation.
That's why the tests made in the mentioned PR don't detect this issue -- they don't try to run rustdoc on the chosen version.
Proposed solution: change the code so that when there are only pre-releases and yanked releases, pick the pre-release, and when there aren't any, report that there are no matching releases (or report that there are only yanked releases, which we don't support). Then, consider adding some integration tests to check that the tool is able to generate the rustdoc for the edge-cases.
Related issue asking for a way to allow cargo to generate a lockfile for a yanked release: https://github.com/rust-lang/cargo/issues/4225
This is probably a low-priority issue right now. Most crates won't hit this, and it's possible that cargo might end up allowing lockfiles for yanked crates to be generated in the meantime. Let's focus our efforts on more valuable issues right now.
FYI rust-lang/cargo#13333 has been posted
Thanks, keeping an eye on it! 🚀