Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can use use semver metadata/pre-release for Crates.io #1

Closed
Eh2406 opened this issue Apr 18, 2023 · 3 comments
Closed

Can use use semver metadata/pre-release for Crates.io #1

Eh2406 opened this issue Apr 18, 2023 · 3 comments

Comments

@Eh2406
Copy link

Eh2406 commented Apr 18, 2023

In the readme:

The extra nightly metadata breaks Cargo's semver rules, so we won't be publishing to crates.io.

With an example of "nightly-2023-04-12-v0.1.4", which is not a valid semver version. But "0.1.4+nightly-2023-04-12" is a valid semver using the metadata part of semver. Or "0.1.4-nightly-2023-04-12" using the pre-release part of semver. https://regex101.com/r/DTge1n/1

@willcrichton
Copy link
Contributor

You're right in that I can use the semver metadata field. I wrote that line based on this excerpt from the Cargo book:

SemVer has the concept of "version metadata" with a plus in the version, such as 1.0.0+21AF26D3. This metadata is usually ignored, and should not be used in a version requirement. You should never publish multiple versions that differ only in the metadata tag (note, this is a known issue with crates.io that currently permits this).

My reasoning was that I want rustc-plugin users to have to explicitly list their nightly version in the version requirement. However, if Cargo ignores the metadata in version requirements, then aspect is not enforced.

@Eh2406
Copy link
Author

Eh2406 commented Apr 19, 2023

That makes sense. If you publish version "0.1.4+nightly-2023-04-12" then users of the crate would depend on it with "0.1.4" which does not remind them that it only works with one version of nightly.

pre-release may be a better fit. "0.1.4-nightly-2023-04-12" can only to be depended on if an = requirement is used and prerelease is present. So "=0.1.4-nightly-2023-04-12" will work but "=0.1.4" will not.

willcrichton added a commit that referenced this issue May 22, 2023
@willcrichton
Copy link
Contributor

willcrichton commented May 22, 2023

I just changed the release model to use the prerelease tags as you suggested @Eh2406. Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants