gltf icon indicating copy to clipboard operation
gltf copied to clipboard

Pin sub-crate versions

Open ShaddyDC opened this issue 1 year ago • 0 comments

I guess this won't be relevant much longer in the context of #409, but it would be nice right now.

The problem is, you currently cannot pin a version of this crate because it doesn't pin its subcrates. That is, as described here, a version of the form "1.3.0" is implicitly "^1.3.0" and thus also accepts "1.4.0" as valid, assuming it to be a semantic version. You can pin the gltf crate with "=1.3.0", but because it depends on gltf-json = { path = "gltf-json", version = "1.3.0" }, it will try to load gltf-json version "1.4.0", which isn't compatible and leads to compile errors:

error[E0308]: mismatched types
  --> /home/space/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gltf-1.3.0/src/accessor/sparse.rs:41:9
   |
40 |     pub fn offset(&self) -> u32 {
   |                             --- expected `u32` because of return type
41 |         self.json.byte_offset
   |         ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `USize64`

etc

I am a bit surprised it loads the subcrates from cargo separately, but I guess that's just how the resolution works?

Now, this can be mitigated with a lock-file, but it breaks if you want to update that lockfile. As a simple fix until version 2.0 is released, I suggest just pinning the sub-crates (ie gltf-json = { path = "gltf-json", version = "=1.4.0" }). Then again, if 2.0 is the next release, it probably doesn't really matter anymore at this point.

ShaddyDC avatar Jan 08 '24 09:01 ShaddyDC