Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test for ice-3717.rs #13230

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/ui/crashes/ice-3717.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![deny(clippy::implicit_hasher)]

use std::collections::HashSet;

fn main() {}

pub fn ice_3717<S: ::std::hash::BuildHasher + Default>(_: &HashSet<usize, S>) {
//~^ ERROR: parameter of type `HashSet` should be generalized over different hashers
let _ = [0u8; 0];
let _: HashSet<usize> = HashSet::default();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run the test in local, the same file is output as when it was deleted.
I need to investigate this a bit more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run the test in 22eeb11, and I found the ice-3717.1.fixed and ice-3717.2.fixed.

ice-3717.1.fixed

#![deny(clippy::implicit_hasher)]


use std::collections::HashSet;

fn main() {}

pub fn ice_3717<S: ::std::hash::BuildHasher + Default>(_: &HashSet<usize, S>) {
    //~^ ERROR: parameter of type `HashSet` should be generalized over different hashers
    let _ = [0u8; 0];
    let _: HashSet<usize> = HashSet::new();
}

ice-3717.2.fixed

#![deny(clippy::implicit_hasher)]


use std::collections::HashSet;

fn main() {}

pub fn ice_3717(_: &HashSet<usize>) {
    //~^ ERROR: parameter of type `HashSet` should be generalized over different hashers
    let _ = [0u8; 0];
    let _: HashSet<usize> = HashSet::default();
}

However, running it on the current master branch will only generate one test.

2 changes: 0 additions & 2 deletions tests/ui/crashes/ice-3717.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![deny(clippy::implicit_hasher)]

//@no-rustfix: need to change the suggestion to a multipart suggestion

use std::collections::HashSet;

fn main() {}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/crashes/ice-3717.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: parameter of type `HashSet` should be generalized over different hashers
--> tests/ui/crashes/ice-3717.rs:9:21
--> tests/ui/crashes/ice-3717.rs:7:21
|
LL | pub fn ice_3717(_: &HashSet<usize>) {
| ^^^^^^^^^^^^^^
Expand Down