Open why-not-try-calmer opened 1 year ago
@why-not-try-calmer sorry you ran into this error. I think it's possible this may be due to not using nightly rust. I was able to reproduce the issue using stable rust:
geoq ➸ rustup default stable
info: using existing install for 'stable-aarch64-apple-darwin'
info: default toolchain set to 'stable-aarch64-apple-darwin'
stable-aarch64-apple-darwin unchanged - rustc 1.69.0 (84c898d65 2023-04-16)
geoq ➸ rustup -V
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.69.0 (84c898d65 2023-04-16)`
geoq ➸ rustup default stable
geoq ➸ cargo install geoq
# ... bunch of output including these etc:
error[E0308]: mismatched types
--> /Users/horace/.cargo/registry/src/github.com-1ecc6299db9ec823/geoq-0.0.25/src/geoq/fgb/geometry.rs:256:9
|
256 | parts,
| ^^^^^ expected `WIPOffset<Vector<'_, ...>>`, found a different `WIPOffset<Vector<'_, ...>>`
However it's not 100% clear what version of the rust toolchain you were using in your post, so if you think you were using nightly can you let me know which version? You should be able to get it via rustup -V
Unfortunately when I tried the latest nightly rust toolchain I actually ran into another separate error: https://github.com/georust/geo/issues/1010
geoq ➸ rustup default nightly
info: using existing install for 'nightly-aarch64-apple-darwin'
info: default toolchain set to 'nightly-aarch64-apple-darwin'
nightly-aarch64-apple-darwin unchanged - rustc 1.71.0-nightly (18bfe5d8a 2023-05-14)
geoq ➸ rustup -V
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.71.0-nightly (18bfe5d8a 2023-05-14)`
geoq ➸ cargo install geoq
# bunch of output, ending with...
error[E0275]: overflow evaluating the requirement `[closure@/Users/horace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/geo-0.23.1/src/algorithm/map_coords.rs:855:69: 855:72]: Fn<(geo_types::Coord<T>,)>`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`geo`)
= note: required for `&[closure@/Users/horace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/geo-0.23.1/src/algorithm/map_coords.rs:855:69: 855:72]` to implement `Fn<(geo_types::Coord<T>,)>`
= note: 128 redundant requirements hidden
= note: required for `&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&...` to implement `Fn<(geo_types::Coord<T>,)>`
= note: the full type name has been written to '/var/folders/75/9336gq4s19s_h_cd11cfx8q80000gn/T/cargo-installxywk3g/release/deps/geo-f93e1a6d8732e9b2.long-type-369038258378914190.txt'
For more information about this error, try `rustc --explain E0275`.
error: could not compile `geo` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `geoq v0.0.25`, intermediate artifacts can be found at `/var/folders/75/9336gq4s19s_h_cd11cfx8q80000gn/T/cargo-installxywk3g`
So I may need to dig a bit to find what version of nightly rust does work well at the moment.
Cool. thanks for the reply, let me know if you find the culprit!
@why-not-try-calmer so I think this issue is due to cargo re-processing the dependency graph when you install a crate via cargo install
.
I did not know about this behavior before today, but apparently by default when you install a crate from crates.io via, it does not honor the Cargo.lock
file that is shipped with that version of the crate. This means cargo can re-compute the dependency graph and you end up getting slightly different versions of things than were used when the library was built.
This is a good thing in some cases b/c it lets the system keep auto-updating things like minor version bumps, avoid crate versions that may have been "yanked", etc. But it can also mean things drift in ways that end up being incompatible, which is what happened here.
In the short term, I think it should work for you if you re-run your install with cargo install geoq --locked
.
The --locked
should tell it to use the versions from Cargo.lock
, which should be consistent with one another.
I need to think a little more about the best way to handle this in the future. I probably need to either lock down some of the crate's dependency versions more tightly, or possibly change the default install instructions from the README
to use the --locked
flag.
https://doc.rust-lang.org/cargo/commands/cargo-install.html#dealing-with-the-lockfile
After a little messing around I managed to install geoq 0.0.25 using rustc 1.77.0-nightly (11f32b73e 2024-01-31), although the older version of nightly that I tried first did not work. Figured I'd share my steps here in case they're helpful to anyone.
$ cd ~ # to be clear, I'm building from crates.io, not from a local copy of the source code
$ rustup toolchain install nightly
...
nightly-x86_64-apple-darwin updated - rustc 1.77.0-nightly (11f32b73e 2024-01-31) (from rustc 1.75.0-nightly (475c71da0 2023-10-11))
$ cargo +nightly install geoq --locked
...
Finished release [optimized + debuginfo] target(s) in 3m 05s
Installing /Users/jake/.cargo/bin/geoq
Installed package `geoq v0.0.25` (executable `geoq`)
$ geoq --version
geoq 0.0.25
error_log.txt