Add test for ICE #3717 fix

This commit is contained in:
flip1995 2019-02-16 22:41:06 +01:00
parent f204b7ec76
commit 9148fc274a
No known key found for this signature in database
GPG key ID: 693086869D506637
2 changed files with 26 additions and 0 deletions

8
tests/ui/ice-3717.rs Normal file
View file

@ -0,0 +1,8 @@
use std::collections::HashSet;
fn main() {}
pub fn ice_3717(_: &HashSet<usize>) {
let _ = [0u8; 0];
let _: HashSet<usize> = HashSet::new();
}

18
tests/ui/ice-3717.stderr Normal file
View file

@ -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<usize>) {
| ^^^^^^^^^^^^^^
|
= note: `-D clippy::implicit-hasher` implied by `-D warnings`
help: consider adding a type parameter
|
LL | pub fn ice_3717<S: ::std::hash::BuildHasher + Default>(_: &HashSet<usize, S>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
help: ...and use generic constructor
|
LL | let _: HashSet<usize> = HashSet::default();
| ^^^^^^^^^^^^^^^^^^
error: aborting due to previous error