Warn/confirm about < 1.0.0 dependencies when publishing 1.0.0 #6018
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-publish
S-propose-close
Status: A team member has nominated this for closing, pending further input from the team
I have two crates that I made the mistake of prematurely releasing 1.0 before their public dependencies had released their 1.0, both newbie mistakes but easy to make:
In this case I misunderstood semver and thought that a breaking change in 0.x required a bump to 1.x. Unfortunately this crate has
image
as a public dependency which is not 1.0 yet; I have been able to work around the issue by supporting a wide range ofimage
versions using a minimal de facto-stable subset of its API.Here, because the API was simple and I figured I wouldn't need to make any breaking changes in the foreseeable future, I went ahead and released a 1.0 as was being encouraged at the time. Unfortunately the API is coupled to the
mime
crate which has two major pre-1.0 versions that are incompatible with each other. I was able to provide support for mime 0.3 by issuing a 2.0-prerelease but this has its own problems (#6016); I will probably have to fix this by publishing a new major version for everymime
pre-1.0 version.If I had realized soon enough I could have yanked the 1.0 releases but in both cases it wasn't made clear to me until long after the fact, several minor releases in after other people had started to depend on them and were assuming 1.0 was stable.
AFAIK, there is nothing anywhere in Cargo's documentation to remind the user that public dependencies are part of a crate's API and need to be considered when making the stability guarantee of a 1.0 release. It's not a hard conclusion to reach with a little bit of thought, but that unfortunately means it's easy for some people (including myself) not to realize until it's too late.
My recommendation is to notify the user when running
cargo publish
at specifically version 1.0.0 that any dependencies that are not 1.0 yet may be breaking changes to upgrade if any part of their API is reexported. To be sure they see and acknowledge the warning, it should probably require confirmation before continuing.Since it would be exceedingly complex to determine whether any dependencies are actually reexported, this only needs to be a warning and not an error; and to avoid being overly repetitive it's really only necessary when releasing 1.0.0, or perhaps any version >= 1.0.0 when all previously released versions were 1.0-prerelease or less (in case the user accidentally/intentionally skips
1.0.0
).The text was updated successfully, but these errors were encountered: