Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexMap called with the wrong number of type arguments? #466

Closed
epigramengineer opened this issue Aug 2, 2020 · 3 comments
Closed

IndexMap called with the wrong number of type arguments? #466

epigramengineer opened this issue Aug 2, 2020 · 3 comments

Comments

@epigramengineer
Copy link

I fully expect this to be user error but hopefully you can point me in the right direction. I'm using using tower-ready-cache 0.3.1 and compiling with rust 1.45.1, and when I do so I get the following error:

INFO: From Compiling Rust lib tower_ready_cache v0.3.1 (4 files):
error[E0107]: wrong number of type arguments: expected 3, found 2
  --> cargo/vendor/tower-ready-cache-0.3.1/src/cache.rs:64:25
   |
64 |     pending_cancel_txs: IndexMap<K, CancelTx>,
   |                         ^^^^^^^^^^^^^^^^^^^^^ expected 3 type arguments

error[E0107]: wrong number of type arguments: expected 3, found 2
  --> cargo/vendor/tower-ready-cache-0.3.1/src/cache.rs:72:12
   |
72 |     ready: IndexMap<K, (S, CancelPair)>,
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 type arguments

error: aborting due to 2 previous errors

Any idea why this would be or if I'm using imcompatible versions? I know 0.3.1 is the version that tonic depends on, and tonic's documentation says it just needs rust 1.39 or above.

Is there a --cfg option I need to be providing during compilation?

Link to first error
Link to second error

I can tell from the documentation that index_map supports 2 type arguments, so what am I doing wrong here?

@LucioFranco
Copy link
Member

Sounds like indexmap released a breaking version? @jonhoo any idea?

@jonhoo
Copy link
Collaborator

jonhoo commented Aug 5, 2020

Hmm... A new indexmap version was just released (1.5.0), though it didn't change the type arguments in any way as far as I can tell. And the third type parameter has a default, so the compiler should never require it. Does the same compiler error appear for you on an older version of the compiler? Are you running with any patch sections in your Cargo.toml?

Maybe @cuviper can shed some light here?

@cuviper
Copy link

cuviper commented Aug 5, 2020

Are you cross-compiling? It could be missing rust flags per cuviper/autocfg#15.
Or if you're using WSL mounts, there might be an output issue as reported in indexmap-rs/indexmap#144.

Since 1.3.0, indexmap uses an autocfg build script to detect std availability. When std is not detected, you don't get the default S = RandomState, so you have to specify S. I think maybe we should add a manual "std" cargo feature to bypass the detection, although we can't make this a default feature as that would break no-std users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants