diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-09-27 15:46:29 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2016-09-29 20:38:35 +1000 |
| commit | 6a9b5e4c51e995120c9739cacb305826a35ac496 (patch) | |
| tree | 761352b47e9495f4aab2b6ee77330e323b4c1517 /src/test/incremental/thinlto | |
| parent | 8ccfc695b56c102a2e7e95719b398bfa0a5e8af1 (diff) | |
| download | rust-6a9b5e4c51e995120c9739cacb305826a35ac496.tar.gz rust-6a9b5e4c51e995120c9739cacb305826a35ac496.zip | |
Clarify HashMap's capacity handling.
This commit does the following.
- Changes the terminology for capacities used within HashMap's code.
"Internal capacity" is now consistently "raw capacity", and "usable
capacity" is now consistently just "capacity". This makes the code
easier to understand.
- Reworks capacity and raw capacity computations. Raw capacity
computations are now handled in a single place:
`DefaultResizePolicy::raw_capacity()`. This function correctly returns
zero when given zero, which means that the following cases now result
in a capacity of zero when they previously did not.
* `Hash{Map,Set}::with_capacity(0)`
* `Hash{Map,Set}::with_capacity_and_hasher(0)`
* `Hash{Map,Set}::shrink_to_fit()`, when used with a hash map/set whose
elements have all been removed
- Strengthens the language used in the comments describing the above
functions, to make it clearer when they will result in a map/set with
a capacity of zero. The new language is based on the language used for
the corresponding functions in `Vec`.
- Adds tests for the above zero-capacity cases.
- Removes `test_resize_policy` because it is no longer useful.
Diffstat (limited to 'src/test/incremental/thinlto')
0 files changed, 0 insertions, 0 deletions
