cargo-semver-checks icon indicating copy to clipboard operation
cargo-semver-checks copied to clipboard

The tool fails when generating rustdoc of a yanked release from registry

Open tonowak opened this issue 2 years ago • 4 comments

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.

tonowak avatar Jan 09 '23 19:01 tonowak

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

obi1kenobi avatar Jan 29 '23 14:01 obi1kenobi

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.

obi1kenobi avatar Feb 01 '23 03:02 obi1kenobi

FYI rust-lang/cargo#13333 has been posted

epage avatar Jan 22 '24 16:01 epage

Thanks, keeping an eye on it! 🚀

obi1kenobi avatar Jan 22 '24 17:01 obi1kenobi