about summary refs log tree commit diff
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2019-02-16 22:41:06 +0100
committerflip1995 <hello@philkrones.com>2019-02-17 01:50:31 +0100
commit9148fc274ad17dd8911aeff5429ce4ee222d8b35 (patch)
tree3a166f963b284ef710893fd6c32166c7461d7943
parentf204b7ec767b6bcd3b4e0e5893e2108f2d13e031 (diff)
downloadrust-9148fc274ad17dd8911aeff5429ce4ee222d8b35.tar.gz
rust-9148fc274ad17dd8911aeff5429ce4ee222d8b35.zip
Add test for ICE #3717 fix
-rw-r--r--tests/ui/ice-3717.rs8
-rw-r--r--tests/ui/ice-3717.stderr18
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/ice-3717.rs b/tests/ui/ice-3717.rs
new file mode 100644
index 00000000000..21c48f4749c
--- /dev/null
+++ b/tests/ui/ice-3717.rs
@@ -0,0 +1,8 @@
+use std::collections::HashSet;
+
+fn main() {}
+
+pub fn ice_3717(_: &HashSet<usize>) {
+    let _ = [0u8; 0];
+    let _: HashSet<usize> = HashSet::new();
+}
diff --git a/tests/ui/ice-3717.stderr b/tests/ui/ice-3717.stderr
new file mode 100644
index 00000000000..08c53c399c2
--- /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<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
+