-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Consider making the version
field optional in Cargo.toml
#9829
Comments
In my case I have a rust project that is just part of an Electron app. My Having a version can still be useful even if you have |
I have the same issue for something I solely distribute as a At the least it would be nice to able to simply overwrite the version during a build via a CLI flag. Even if the version key didn't have to be present, it would still be ideal to have that so my program could determine the proper version to set in things like a |
I think the most simple solution is for |
This isn't really an issue with what the default version is, but just how to have no version at all. I think that argument merits its own issue imo. |
cargo script (#12207) is defaulting the version to |
Even outside |
Describe the problem you are trying to solve
Today, the
version
field is required. However, in many (most?) cases it doesn't make sense:cargo install
This creates specific issues:
Describe the solution you'd like
Make the
version
field in Cargo.toml optional. Do populate it by default, as it is today. Prevent publishing the crates which (transitively) depend on non-versioned crates.Notes
There is
publish = false
, to my mind that serves a different purpose -- preventing accidental publishing of the crates. It doesn't help with solving confusion problem -- the version is still there, and it still doesn't have a meaning. Although, if we were to re-design Cargo from scratch, I would argue that we shouldn't havepublish
field at all, and insead define it aspublish = version.is_some()
.Implementation wise, it seems like we can desugar absence of version as
version = "0.0.0" publish = false
. I personally useversion = "0.0.0"
as a way to explicitly signal that there's no meaningful version.The text was updated successfully, but these errors were encountered: