Skip to content

Docs - type guarantees update - #129822

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
WiktorPrzetacznik:docs-guarantees-update
Oct 3, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
WiktorPrzetacznik:docs-guarantees-update

Conversation

@WiktorPrzetacznik

@WiktorPrzetacznik WiktorPrzetacznik commented Aug 31, 2024 •

Copy link
Copy Markdown
Contributor

Content:

  • Pin::map_unchecked | Safety section update
  • String::reserve, String::reserve_exact | Panic section update
  • Saturating | Introduce Layout section
  • Fix typos

Questions:

  1. This proposes to update String reserve methods docs:

    Panics if the new capacity overflows [usize].

    ->

    Panics if the new capacity exceeds [isize::MAX] bytes.

    There are a few other types that are based on Vec and offer similar reserve API (like BinaryHeap).
    Should they be updated, too?

ACP: rust-lang/libs-team#482 [not required]

@rustbot

rustbot commented Aug 31, 2024

Copy link
Copy Markdown
Collaborator

r? @cuviper

rustbot has assigned @cuviper.
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 Aug 31, 2024
@cuviper

cuviper commented Sep 2, 2024

Copy link
Copy Markdown
Member

Have these guarantees been discussed and approved somewhere? The String change is fine IMO, since that is a fundamental limitation of heap allocations (and object sizes in general), and we already state that in Vec docs. Saturating layout is probably fine -- it's transparent, but libs-api should sign off on guaranteeing that. I'm not sure about Pin stuff.

@WiktorPrzetacznik

WiktorPrzetacznik commented Sep 3, 2024 •

Copy link
Copy Markdown
Contributor Author

@cupiver
Here's my discussion about Pin -> https://internals.rust-lang.org/t/why-am-i-not-allowed-to-move-arg-in-pin-map-unchecked/19664/2?u=wiktor

About Saturating - I provoked some discussion on that topic - let's wait for more thoughts on this.
I'll ping you when something happens here.

@cuviper

cuviper commented Sep 24, 2024

Copy link
Copy Markdown
Member

@rustbot author

I'll ping you when something happens here.

You can use @rustbot ready for that.

@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 Sep 24, 2024
@alex-semenyuk

Copy link
Copy Markdown
Member

@WiktorPrzetacznik
From wg-triage. Do you have any updates on this PR?

@WiktorPrzetacznik

Copy link
Copy Markdown
Contributor Author

@alex-semenyuk
Unfortunately not at all, suffering from lack of time, I have some more free time in upcoming days though, so I'm planning on opening an ACP asking about those changes - if there's a better way to get official response from t-libs let me know.

@Dylan-DPC Dylan-DPC added S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 17, 2024
@Amanieu

Amanieu commented Dec 10, 2024

Copy link
Copy Markdown
Member

r? libs-api

@rustbot rustbot added the T-libs-api [DEPRECATED; DO NOT USE] label Dec 10, 2024
@rustbot rustbot assigned BurntSushi and unassigned cuviper Dec 10, 2024
@the8472

the8472 commented Dec 10, 2024 •

Copy link
Copy Markdown
Member

We discussed this during today's libs-API meeting, it looks like there previously was no guarantee for the Saturating layout, so this would constitute an API change and will need an FCP.

Pin is subtle, so we weren't sure on the spot if this constitutes a new guarantee or a clarification, so we'd like input from a Pin expert on that.

@Dylan-DPC Dylan-DPC added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-ACP Status: PR has an ACP and is waiting for the ACP to complete. labels Feb 18, 2025
@bors

bors commented Dec 5, 2025

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #149682) made this pull request unmergeable. Please resolve the merge conflicts.

@reddevilmidzy

Copy link
Copy Markdown
Member

@rustbot author

@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 Jan 18, 2026
@rustbot

rustbot commented Jan 18, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@WiktorPrzetacznik

Copy link
Copy Markdown
Contributor Author

Ok, but what do I do with it? Saturating needs FCP, pin is stuck in oblivion. Are you OK with the other changes?

@clarfonthey clarfonthey removed the T-libs-api [DEPRECATED; DO NOT USE] label Aug 12, 2026
@clarfonthey

Copy link
Copy Markdown
Contributor

A bit confused about the pin change, but the rest are okay to merge. Since Andrew is no longer on the review rotation I can take this.

r? clarfonthey

@clarfonthey

Copy link
Copy Markdown
Contributor

Also cc @WiktorPrzetacznik since I keep forgetting to ping people, if you remove the pin change and rebase I am fine merging this.

Document layout of Saturating, similarly to Wrapping
@rustbot

rustbot commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@clarfonthey

Copy link
Copy Markdown
Contributor

@bors r+ rollup

Thank you!

@rust-bors

rust-bors Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 02d1672 has been tentatively approved by clarfonthey

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 2, 2026
@WiktorPrzetacznik

Copy link
Copy Markdown
Contributor Author

Thanks, btw. I removed the String changes, as they're already present in recent main, which wasn't the case in 2024 when I started this PR

rust-bors Bot pushed a commit that referenced this pull request Oct 2, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163655 (explicitly handle tests that pass with -Znext-solver)
 - #159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc)
 - #163572 (Update the minimum external LLVM to 22)
 - #129822 (Docs - type guarantees update)
 - #157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules)
 - #162332 (preserve overflow in builtin Field candidates)
 - #163574 (intrinsics: Rename `abort` to `abort_immediate`)
 - #163638 (avoid trivial `fn map_bound` validations)
 - #163660 (yeet compare-mode-coherence)
rust-bors Bot pushed a commit that referenced this pull request Oct 3, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163655 (explicitly handle tests that pass with -Znext-solver)
 - #159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc)
 - #163572 (Update the minimum external LLVM to 22)
 - #129822 (Docs - type guarantees update)
 - #157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules)
 - #162332 (preserve overflow in builtin Field candidates)
 - #163574 (intrinsics: Rename `abort` to `abort_immediate`)
 - #163638 (avoid trivial `fn map_bound` validations)
 - #163660 (yeet compare-mode-coherence)
@rust-bors
rust-bors Bot merged commit 764a91c into rust-lang:main Oct 3, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 3, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 3, 2026
Rollup merge of #129822 - WiktorPrzetacznik:docs-guarantees-update, r=clarfonthey

Docs - type guarantees update

**Content:**
- Pin::map_unchecked | Safety section update
- String::reserve, String::reserve_exact | Panic section update
- Saturating | Introduce Layout section
- Fix typos

**Questions:**

1. This proposes to update String reserve methods docs:

    > Panics if the new capacity overflows [`usize`].

    ->

    > Panics if the new capacity exceeds [`isize::MAX`] bytes.

    There are a few other types that are based on Vec and offer similar reserve API (like BinaryHeap).
    Should they be updated, too?

ACP: ~~rust-lang/libs-team#482 [not required]
github-actions Bot pushed a commit to rust-lang/stdarch that referenced this pull request Oct 5, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver)
 - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc)
 - rust-lang/rust#163572 (Update the minimum external LLVM to 22)
 - rust-lang/rust#129822 (Docs - type guarantees update)
 - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules)
 - rust-lang/rust#162332 (preserve overflow in builtin Field candidates)
 - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`)
 - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations)
 - rust-lang/rust#163660 (yeet compare-mode-coherence)
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Oct 5, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver)
 - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc)
 - rust-lang/rust#163572 (Update the minimum external LLVM to 22)
 - rust-lang/rust#129822 (Docs - type guarantees update)
 - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules)
 - rust-lang/rust#162332 (preserve overflow in builtin Field candidates)
 - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`)
 - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations)
 - rust-lang/rust#163660 (yeet compare-mode-coherence)
programskillforverification pushed a commit to programskillforverification/miri that referenced this pull request Oct 5, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver)
 - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc)
 - rust-lang/rust#163572 (Update the minimum external LLVM to 22)
 - rust-lang/rust#129822 (Docs - type guarantees update)
 - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules)
 - rust-lang/rust#162332 (preserve overflow in builtin Field candidates)
 - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`)
 - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations)
 - rust-lang/rust#163660 (yeet compare-mode-coherence)
AzureXuanVerse pushed a commit to AzureXuanVerse/rustfmt that referenced this pull request Oct 7, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver)
 - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc)
 - rust-lang/rust#163572 (Update the minimum external LLVM to 22)
 - rust-lang/rust#129822 (Docs - type guarantees update)
 - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules)
 - rust-lang/rust#162332 (preserve overflow in builtin Field candidates)
 - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`)
 - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations)
 - rust-lang/rust#163660 (yeet compare-mode-coherence)
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Oct 8, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#163655 (explicitly handle tests that pass with -Znext-solver)
 - rust-lang/rust#159924 (Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc)
 - rust-lang/rust#163572 (Update the minimum external LLVM to 22)
 - rust-lang/rust#129822 (Docs - type guarantees update)
 - rust-lang/rust#157973 (Distinguish `repr(C)` ZSTs from others in ABI compatibility rules)
 - rust-lang/rust#162332 (preserve overflow in builtin Field candidates)
 - rust-lang/rust#163574 (intrinsics: Rename `abort` to `abort_immediate`)
 - rust-lang/rust#163638 (avoid trivial `fn map_bound` validations)
 - rust-lang/rust#163660 (yeet compare-mode-coherence)
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.