mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Add test for ICE #3717 fix
This commit is contained in:
parent
f204b7ec76
commit
9148fc274a
2 changed files with 26 additions and 0 deletions
8
tests/ui/ice-3717.rs
Normal file
8
tests/ui/ice-3717.rs
Normal 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
18
tests/ui/ice-3717.stderr
Normal 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
|
||||
|
Loading…
Reference in a new issue