about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-14 15:55:00 +0000
committerbors <bors@rust-lang.org>2023-11-14 15:55:00 +0000
commit0c42e451d643d54347aa47d7bc6c731896fe5fde (patch)
treecb668925f1e91c87c7671fe9d94efb0c194472cf /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parentca8f33e19b7a64d2817e8e8f9c4ef382af46b254 (diff)
parentf8ea496495d2766536d7f0fe11c03d609e8ed837 (diff)
downloadrust-0c42e451d643d54347aa47d7bc6c731896fe5fde.tar.gz
rust-0c42e451d643d54347aa47d7bc6c731896fe5fde.zip
Auto merge of #11791 - Jacherr:iter_over_hash_type, r=Jarcho
Implement new lint `iter_over_hash_type`

Implements and fixes https://github.com/rust-lang/rust-clippy/issues/11788

This PR adds a new *restriction* lint `iter_over_hash_type` which prevents `Hash`-types (that is, `HashSet` and `HashMap`) from being used as the iterator in `for` loops.

The justification for this is because in `Hash`-based types, the ordering of items is not guaranteed and may vary between executions of the same program on the same hardware. In addition, it reduces readability due to the unclear iteration order.

The implementation of this lint also ensures the following:
- Calls to `HashMap::keys`, `HashMap::values`, and `HashSet::iter` are also denied when used in `for` loops,
- When this expression is used in procedural macros, it is not linted/denied.

changelog: add new `iter_over_hash_type` lint to prevent unordered iterations through hashed data structures
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions