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

document capacity for ZST as example #136293

Merged
merged 1 commit into from
Mar 17, 2025
Merged

document capacity for ZST as example #136293

merged 1 commit into from
Mar 17, 2025

Conversation

hkBst
Copy link
Member

@hkBst hkBst commented Jan 30, 2025

The main text already covers this, although it provides weaker guarantees, but I think an example in the right spot does not hurt. Fixes #80747

@rustbot
Copy link
Collaborator

rustbot commented Jan 30, 2025

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 30, 2025
@Amanieu
Copy link
Member

Amanieu commented Feb 7, 2025

It might be worth copying this sentence from the docs of with_capacity:

For Vec where T is a zero-sized type, there will be no allocation and the capacity will always be usize::MAX.

@alex-semenyuk
Copy link
Member

Triage: comment is not addressed
@rustbot label: +S-waiting-on-author, -S-waiting-on-review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 9, 2025
@hkBst
Copy link
Member Author

hkBst commented Mar 9, 2025

It might be worth copying this sentence from the docs of with_capacity:

For Vec where T is a zero-sized type, there will be no allocation and the capacity will always be usize::MAX.

I've now included a sentence that says:

A vector with zero-sized elements will always have a capacity of usize::MAX:

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 9, 2025
@Amanieu
Copy link
Member

Amanieu commented Mar 16, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Mar 16, 2025

📌 Commit db7e61c has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 16, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 16, 2025
document capacity for ZST as example

The main text already covers this, although it provides weaker guarantees, but I think an example in the right spot does not hurt. Fixes rust-lang#80747
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 16, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#136293 (document capacity for ZST as example)
 - rust-lang#136355 (Add `*_value` methods to proc_macro lib)
 - rust-lang#136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove)
 - rust-lang#136816 (refactor `notable_traits_button` to use iterator combinators  instead of for loop)
 - rust-lang#138363 (Add `From<{integer}>` for `f16`/`f128` impls)
 - rust-lang#138552 (Misc print request handling cleanups + a centralized test for print request stability gating)
 - rust-lang#138573 (Make `_Unwind_Action` a type alias, not enum)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#136293 (document capacity for ZST as example)
 - rust-lang#136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove)
 - rust-lang#136816 (refactor `notable_traits_button` to use iterator combinators  instead of for loop)
 - rust-lang#138552 (Misc print request handling cleanups + a centralized test for print request stability gating)
 - rust-lang#138573 (Make `_Unwind_Action` a type alias, not enum)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c770040 into rust-lang:master Mar 17, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 17, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 17, 2025
Rollup merge of rust-lang#136293 - hkBst:patch-32, r=Amanieu

document capacity for ZST as example

The main text already covers this, although it provides weaker guarantees, but I think an example in the right spot does not hurt. Fixes rust-lang#80747
@hkBst hkBst deleted the patch-32 branch March 17, 2025 07:56
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request Mar 26, 2025
document capacity for ZST as example

The main text already covers this, although it provides weaker guarantees, but I think an example in the right spot does not hurt. Fixes rust-lang#80747
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request Mar 26, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#136293 (document capacity for ZST as example)
 - rust-lang#136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove)
 - rust-lang#136816 (refactor `notable_traits_button` to use iterator combinators  instead of for loop)
 - rust-lang#138552 (Misc print request handling cleanups + a centralized test for print request stability gating)
 - rust-lang#138573 (Make `_Unwind_Action` a type alias, not enum)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infinite loop when trying to fill a Vector of MaybeUninit<SomeZeroSizedType>
5 participants