Closed kornelski closed 4 years ago
Is your crates-index git repo up-to-date? Not sure how this can happen if so... 🤔
For reference https://github.com/rust-lang/crates.io-index/blob/master/3/n/nom
Yes (980c95aa38f51b34c13983ac1dc0d085833c44f0).
4.0.0 is in versions()
, but it's not last in the array.
OK, from the code I don't see how can it happen either. My computer must be cursed ;)
I've found another case where it gives "wrong" result:
The issue is that "latest" here means most recently published, rather than highest according to semver. If that's the intended behavior, I think it should come with huge warning in the docs, since that is not a useful behavior for version resolution.
I'd be in favor of introducing new functionality which retrieves the highest semver crate version (via the semver
crate). I'm not sure what this would be called, maybe highest_version
? To me, latest_version
implies the newest published crate version, but I can see how it can be interpreted to be the highest semver version. I'm a bit short on time, but if you or anyone else wants to open a PR for this, I'd accept such a change.
I can open a PR to implement this if there is still interest to merge it.
In building https://lib.rs I've noticed that I need highest stable version as often as absolutely highest including prereleases. Having both would be useful.
I'm not sure how to name them.
I have implemented a draft over at #39. Feedback welcome. I am not sure about the naming with the _unchecked
version. The latest_semver_version
one should be enough. I just return the values returned by Iterator::max
, but since I can't think of a case where a crate is inside the index but has no single semver compatible version we might as well unwrap directly as it seems to be a safe operation.
Currently,
crate.latest_version()
fornom
gives4.0.0-beta3
, but should give4.0.0
stable.