gx0r/rrgeo

Cannot add to project; dependency Kiddo can't compile

lightningandthunder opened this issue · 4 comments

I suddenly have an issue where I can't build any project with this crate in it; I get this error message:

Compiling kiddo v3.0.0
error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
  --> /home/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/kiddo-3.0.0/src/common/generate_within_unsorted_iter.rs:44:32
   |
44 |                   mut gen_scope: Scope<'a, (), NearestNeighbour<A, T>>,
   |                                  ^^^^^ -- supplied 1 lifetime argument
   |                                  |
   |                                  expected 2 lifetime arguments
   |
  ::: /home/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/kiddo-3.0.0/src/fixed/query/within_unsorted_iter.rs:18:5
   |
18 | /     generate_within_unsorted_iter!(
19 | |         (r#"Finds all elements within `dist` of `query`, using the specified
20 | | distance metric function.
21 | |
...  |
44 | | ```"#)
45 | |     );
   | |_____- in this macro invocation
   |
note: struct defined here, with 2 lifetime parameters: `'scope`, `'a`
  --> /home/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/generator-0.7.6/src/scope.rs:16:12
   |
16 | pub struct Scope<'scope, 'a, A, T> {
   |            ^^^^^ ------  --
   = note: this error originates in the macro `generate_within_unsorted_iter` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add missing lifetime argument
   |
44 |                 mut gen_scope: Scope<'a, 'a, (), NearestNeighbour<A, T>>,
   |                                        ++++

error[E0107]: struct takes 2 lifetime arguments but 1 lifetime argument was supplied
  --> /home/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/kiddo-3.0.0/src/common/generate_within_unsorted_iter.rs:44:32
   |
44 |                   mut gen_scope: Scope<'a, (), NearestNeighbour<A, T>>,
   |                                  ^^^^^ -- supplied 1 lifetime argument
   |                                  |
   |                                  expected 2 lifetime arguments
   |
  ::: /home/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/kiddo-3.0.0/src/float/query/within_unsorted_iter.rs:43:5
   |
43 | /     generate_float_within_unsorted_iter!(
44 | |         "
45 | | let mut tree: KdTree<f64, 3> = KdTree::new();
46 | | tree.add(&[1.0, 2.0, 5.0], 100);
47 | | tree.add(&[2.0, 3.0, 6.0], 101);"
48 | |     );
   | |_____- in this macro invocation
   |
note: struct defined here, with 2 lifetime parameters: `'scope`, `'a`
  --> /home/mike/.cargo/registry/src/index.crates.io-6f17d22bba15001f/generator-0.7.6/src/scope.rs:16:12
   |
16 | pub struct Scope<'scope, 'a, A, T> {
   |            ^^^^^ ------  --
   = note: this error originates in the macro `generate_within_unsorted_iter` which comes from the expansion of the macro `generate_float_within_unsorted_iter` (in Nightly builds, run with -Z macro-backtrace for more info)
help: add missing lifetime argument
   |
44 |                 mut gen_scope: Scope<'a, 'a, (), NearestNeighbour<A, T>>,
   |                                        ++++

For more information about this error, try `rustc --explain E0107`.
error: could not compile `kiddo` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

I can reproduce this in a brand new project:

cargo new something
cd something
cargo add reverse-geocoder
cargo build

Looks like this is still an open issue with Kiddo - sdd/kiddo#154

I made a PR to work around this; feel free to merge if you think it's valuable.

gx0r commented

Thanks for the report and PR. I may wait for the upstream fix...not sure yet

gx0r commented
  • Ran a cargo update and it downgraded the generator version to one that compiles
  • Published 4.1.1

Looks like https://crates.io/crates/generator/versions 0.7.6.was yanked.