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

Doc states no iter_mut on HashMap but there is #94755

Closed
BarePotato opened this issue Mar 8, 2022 · 4 comments · Fixed by #95326
Closed

Doc states no iter_mut on HashMap but there is #94755

BarePotato opened this issue Mar 8, 2022 · 4 comments · Fixed by #95326
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@BarePotato
Copy link

BarePotato commented Mar 8, 2022

//! While many collections offer `iter()`, not all offer `iter_mut()`. For
//! example, mutating the keys of a [`HashSet<T>`] or [`HashMap<K, V>`] could
//! put the collection into an inconsistent state if the key hashes change, so
//! these collections only offer `iter()`.

While many collections offer iter(), not all offer iter_mut(). For example, mutating the keys of a HashSet or HashMap<K, V> could put the collection into an inconsistent state if the key hashes change, so these collections only offer iter().

HashMap clearly has iter_mut https://doc.rust-lang.org/std/collections/struct.HashMap.html#method.iter_mut while HashSet does not.

Docs should be changed to reflect this. I would be happy to do this, but as I have not contributed to Rust before, wanted to make sure I didn't miss something here.

@BarePotato
Copy link
Author

I also realize that the key itself is reference as seen here https://doc.rust-lang.org/std/collections/hash_map/struct.IterMut.html#associatedtype.Item but feel the wording here being updated is still valid.

@compiler-errors
Copy link
Member

I agree this wording should be updated. Perhaps "or HashMap<K, V>" should just be removed.

@compiler-errors
Copy link
Member

@BarePotato are you still planning on making this change?

@lupd
Copy link
Contributor

lupd commented Mar 26, 2022

@rustbot label +A-docs +E-easy

@rustbot rustbot added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Mar 26, 2022
@bors bors closed this as completed in 1fca19c Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants