Rust-clippy: assertion failed: ctr_vis.suggestions.is_empty()

Created on 2 Jan 2018  ยท  6Comments  ยท  Source: rust-lang/rust-clippy

I'm seeing the following when I try to upgrade nightly/clippy on a work project. I've tried two different clippy versions: 0.0.175 and 0.0.177, and I saw the same error.

โฏ cargo clippy --profile=test
lib: safe_app
   Compiling safe_app v0.5.0 (file:///Users/marcin/Dropbox/Work/maidsafe/safe_client_libs/safe_app)
thread 'rustc' panicked at 'assertion failed: ctr_vis.suggestions.is_empty()', /Users/marcin/.cargo/registry/src/github.com-1ecc6299db9ec823/clippy_lints-0.0.177/src/types.rs:1598:24
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'main' panicked at 'rustc_thread failed: Any', src/libcore/result.rs:916:4
error: Could not compile `safe_app`.

To learn more, run the command again with --verbose.

Our branch can be found at https://github.com/m-cat/safe_client_libs/tree/rust-1.22.1. I'm running cargo clippy --profile=test from the safe_app directory. Please let me know if further information is needed.

Most helpful comment

Great!

All 6 comments

Disabling the lint to get around this doesn't work:

#![cfg_attr(feature="cargo-clippy", allow(implicit_hasher))]

Clippy still appears to be entering this function: https://github.com/rust-lang-nursery/rust-clippy/blob/master/clippy_lints/src/types.rs#L1598. I would think that this should not be the case if the lint is disabled.

Does anyone know of other possible workarounds so we could proceed with our compiler upgrade?

I'm on it

@m-cat

can you confirm that

error: parameter of type `HashMap` should be generalized over different hashers
   --> safe_app/src/test_utils.rs:100:25
    |
100 |     access_info: Option<HashMap<String, ContainerPermissions>>,
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: lint level defined here
   --> safe_app/src/lib.rs:37:17
    |
37  |            deny(clippy, unicode_not_nfc, wrong_pub_self_convention, option_unwrap_used))]
    |                 ^^^^^^
    = note: #[deny(implicit_hasher)] implied by #[deny(clippy)]
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.178/index.html#implicit_hasher
help: consider adding a type parameter
    |
98  | pub fn create_auth_req<S: ::std::hash::BuildHasher + Default>(
99  |     app_id: Option<String>,
100 |     access_info: Option<HashMap<String, ContainerPermissions, S>>,
    |
help: ...and use generic constructor
    |
109 |         None => (false, HashMap::default()),
    |                         ^^^^^^^^^^^^^^^^^^

error: parameter of type `HashMap` should be generalized over different hashers
   --> safe_app/src/test_utils.rs:126:18
    |
126 |     access_info: HashMap<String, ContainerPermissions>,
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.178/index.html#implicit_hasher
help: consider adding a type parameter
    |
125 | pub fn create_auth_req_with_access<S: ::std::hash::BuildHasher>(
126 |     access_info: HashMap<String, ContainerPermissions, S>,
    |

error: Could not compile `safe_app`.

makes sense in the context of safe_app?

If so, this is fixed on master. Please use the master branch until we create a new release

Yes, these changes would be nice, as users of our API may be using different hash implementations.

Great!

@oli-obk thanks for fixing this! :)

Was this page helpful?
0 / 5 - 0 ratings