I'm experiencing some confusing behaviour from cargo
involving a particular crate, and I'm unsure whether it's something that:
- I should report to the crate maintainer
- I should report as a bug in
cargo
- I should report as a bug to crates.io
- is some combination of the above
I'll now layout some background, then describe the confusing behaviour.
First, the crate I'm trying to use is raylib-rs
, which is a Rust binding to Raylib, which is a library for making games, written in C. I've used this crate before, to write small hobby games/game protoypes, etc. and I even made a template to make starting new projects with the library quicker. This prior usage has been with version 3.5 of the crate, which corresponds to version 3.5 of the C library.
Version 3.7 of Raylib, the C library, has been released, and correspondingly, version 3.7.0
of raylib-rs
has been released. Some parts of the API have been added, at least one small part removed, and other parts have been renamed between the two versions. Because the weird behaviour is related to version selection, I'll mention that I don't believe the version numbering strictly follows Semantic Versioning as described at semver.org. The confusing part happened after I started trying to update my template project to use 3.7.0
.
Specifically, I am able to repeatedly perform the following steps and end up with a crate in a confusing state:
- Copy commit
e5e5bbe
of my template to a new folder, (note, without atarget
directory). I am able to successfully run the program withcargo r
, (which of course creates atarget
directory). When running it I seeCompiling raylib-sys v3.5.0
in the terminal output first. - Change the specific
Cargo.toml
file that specifies theraylib-rs
dependency. Specifically, change the lineraylib = { version = "3.5" }
toraylib = { version = "3.7" }
. After runningcargo r
we seeCompiling raylib-sys v3.7.0
in the output, and it fails to compile because the API has changed. Also, the Cargo.lock file has been updated. All expected behaviour so far, I think. - Change the line in that Cargo.toml back from
raylib = { version = "3.7" }
toraylib = { version = "3.5" }
. Then runcargo r
again. I see the same compile errors as the previous time. - Since the Cargo.lock had been previously updated, and it contains references to
3.7.0
, I try removing it, and then runningcargo r
again. I again seeCompiling raylib-sys v3.7.0
in the output, and I still see the same compile errors. - If I run
git restore Cargo.lock
then when I runcargo r
then the executable which was previously built with3.5.0
runs. I can then runcargo clean
, and then build a fresh executable withcargo r
. Normal behaviour has been restored.
I'm unable to reproduce it but I also somehow once got it to start compiling raylib 3.7.0
, while that was happening, then the executable built with 3.5.0
started up, then after I closed it, the 3.7.0
crate continued compiling, and eventually ended in the same errors.
As I said at the top, I'm not sure where the best place(s) to report a bug for this is. My best guess is to raise an issue on the cargo repo, but it seemed best to ask here first.
This may be irrelevant, but this is the same machine where I ran into a strange ICE which I reported to the cargo repo. I tried reinstalling stable, as suggested in that issue, after I ran into this issue fir the first time, but that didn't seem to do much in this case.
Edit: Although this post as written seems to point to just expected behaviour, I have described an additional step below that I currently believe indicates an actual bug.