Skip to content

Mention that HashMap::new and HashSet::new do not allocate #44609

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 17, 2017

Conversation

jonhoo
Copy link
Contributor

@jonhoo jonhoo commented Sep 15, 2017

The docs for HashMap::with_capacity and HashSet::with_capacity already say that

If capacity is 0, the hash map/set will not allocate.

However, the docs for ::new do not say that the initial capacity is 0, and thus promise that a call to ::new alone does not allocate. This PR fixes that.

@rust-highfive
Copy link
Contributor

r? @dtolnay

(rust_highfive has picked a reviewer for you, use r? to override)

@jonhoo
Copy link
Contributor Author

jonhoo commented Sep 15, 2017

r? @steveklabnik

@steveklabnik
Copy link
Member

@bors: r+ rollup

thanks a ton!

@bors
Copy link
Collaborator

bors commented Sep 15, 2017

📌 Commit f7e974e has been approved by steveklabnik

@shepmaster shepmaster added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 15, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Sep 16, 2017
Mention that HashMap::new and HashSet::new do not allocate

The docs for `HashMap::with_capacity` and `HashSet::with_capacity` already say that
> If `capacity` is 0, the hash map/set will not allocate.
However, the docs for `::new` do not say that the initial capacity is 0, and thus promise that a call to `::new` alone does not allocate. This PR fixes that.
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Sep 16, 2017
Mention that HashMap::new and HashSet::new do not allocate

The docs for `HashMap::with_capacity` and `HashSet::with_capacity` already say that
> If `capacity` is 0, the hash map/set will not allocate.
However, the docs for `::new` do not say that the initial capacity is 0, and thus promise that a call to `::new` alone does not allocate. This PR fixes that.
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Sep 17, 2017
Mention that HashMap::new and HashSet::new do not allocate

The docs for `HashMap::with_capacity` and `HashSet::with_capacity` already say that
> If `capacity` is 0, the hash map/set will not allocate.
However, the docs for `::new` do not say that the initial capacity is 0, and thus promise that a call to `::new` alone does not allocate. This PR fixes that.
bors added a commit that referenced this pull request Sep 17, 2017
@bors bors merged commit f7e974e into rust-lang:master Sep 17, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants