Skip to content

HashSet/HashMap nesting results to methods not being defined properly #25946

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

Closed
tijsmaas opened this issue Jun 1, 2015 · 2 comments
Closed

Comments

@tijsmaas
Copy link

tijsmaas commented Jun 1, 2015

This compiles just fine:
fn x(input: HashSet<usize>) {
    for i in input.iter() {}
}
This gives compile time error:

no method named iter found for type std::collections::hash::set::HashSet<std::collections::hash::set::HashSet<usize>> in the current scope

fn x(input: HashSet<HashSet<usize>>) {
    for i in input.iter() {}
}

I tested this code on multiple versions of rust using play.rust-lang.org and all versions seem to be affected in the same way. I also noticed that using a HashMap results to the same issue, and in both cases not only iter() is gone, but no single method seems to work. (I only tested iter(), capacity() and clear())

@tijsmaas
Copy link
Author

tijsmaas commented Jun 1, 2015

Here is a live source code example http://is.gd/AEf0vx

@alexcrichton
Copy link
Member

This is actually because HashSet<T> does not itself implement Hash, so this is a dupe of #20941, but thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants