diff --git a/tests/ui/ice-3717.rs b/tests/ui/ice-3717.rs new file mode 100644 index 000000000..21c48f474 --- /dev/null +++ b/tests/ui/ice-3717.rs @@ -0,0 +1,8 @@ +use std::collections::HashSet; + +fn main() {} + +pub fn ice_3717(_: &HashSet) { + let _ = [0u8; 0]; + let _: HashSet = HashSet::new(); +} diff --git a/tests/ui/ice-3717.stderr b/tests/ui/ice-3717.stderr new file mode 100644 index 000000000..08c53c399 --- /dev/null +++ b/tests/ui/ice-3717.stderr @@ -0,0 +1,18 @@ +error: parameter of type `HashSet` should be generalized over different hashers + --> $DIR/ice-3717.rs:5:21 + | +LL | pub fn ice_3717(_: &HashSet) { + | ^^^^^^^^^^^^^^ + | + = note: `-D clippy::implicit-hasher` implied by `-D warnings` +help: consider adding a type parameter + | +LL | pub fn ice_3717(_: &HashSet) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ +help: ...and use generic constructor + | +LL | let _: HashSet = HashSet::default(); + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error +