Skip to content

alloc: Document panics when allocations will exceed max#148662

Merged
bors merged 1 commit intorust-lang:mainfrom
leftmostcat:document-isize-limit
Dec 5, 2025
Merged

alloc: Document panics when allocations will exceed max#148662
bors merged 1 commit intorust-lang:mainfrom
leftmostcat:document-isize-limit

Conversation

@leftmostcat
Copy link
Copy Markdown

Document panics in String and Vec due to capacity overflowing isize::MAX. Correct outdated claims of usize::MAX limit.

Fixes #148598.

Ping @lolbinarycat

@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 Nov 7, 2025
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Nov 7, 2025

r? @joboet

rustbot has assigned @joboet.
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

@rust-log-analyzer

This comment has been minimized.

@leftmostcat
Copy link
Copy Markdown
Author

At a glance, the build failures appear to be related to CI setup and not to these changes.

@lolbinarycat
Copy link
Copy Markdown
Contributor

CI is currently broken, it should be fixed once #148665 is merged.

@rustbot

This comment has been minimized.

Copy link
Copy Markdown
Member

@joboet joboet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you!

View changes since this review

Comment thread library/alloc/src/string.rs Outdated
///
/// # Panics
///
/// Panics if the new capacity exceeds `isize::MAX` _bytes_.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't an old capacity here.

Suggested change
/// Panics if the new capacity exceeds `isize::MAX` _bytes_.
/// Panics if the capacity exceeds `isize::MAX` _bytes_.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do prefer the suggested wording. Presently, Vec uses the "new capacity" phrasing; should I adjust that as well?

@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 Nov 13, 2025
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Nov 17, 2025

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.

@leftmostcat leftmostcat requested a review from joboet November 20, 2025 17:43
@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 Nov 20, 2025
@joboet
Copy link
Copy Markdown
Member

joboet commented Dec 5, 2025

Sorry for the delay, this looks fine!
@bors r+ rollup

@bors
Copy link
Copy Markdown
Collaborator

bors commented Dec 5, 2025

📌 Commit 5a8cf33 has been approved by joboet

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 Dec 5, 2025
bors added a commit that referenced this pull request Dec 5, 2025
Rollup of 11 pull requests

Successful merges:

 - #148662 (alloc: Document panics when allocations will exceed max)
 - #148811 (core docs: rewrite `panic::Location::caller` with visual line/column numbers)
 - #149101 (Improve mutable-binding suggestion to include name)
 - #149477 (float::maximum/minimum: make docs more streamlined)
 - #149547 (library: Rename `IterRange*` to `Range*Iter`)
 - #149548 (Generate delegation error body when delegation is not resolved)
 - #149630 (Check identifiers defined in macros when suggesting identifiers hidden by hygiene)
 - #149647 (Add regression test for 141845)
 - #149661 (Fix for LLVM22 making lowering decisions dependent on RuntimeLibraryInfo.)
 - #149666 (Add perma-unstable `--print=backend-has-zstd` for use by compiletest)
 - #149671 (interpret: test SNaN handling of float min/max and update comments)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4d08c33 into rust-lang:main Dec 5, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Dec 5, 2025
rust-timer added a commit that referenced this pull request Dec 5, 2025
Rollup merge of #148662 - leftmostcat:document-isize-limit, r=joboet

alloc: Document panics when allocations will exceed max

Document panics in `String` and `Vec` due to capacity overflowing `isize::MAX`. Correct outdated claims of `usize::MAX` limit.

Fixes #148598.

Ping `@lolbinarycat`
github-actions Bot pushed a commit to rust-lang/miri that referenced this pull request Dec 6, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#148662 (alloc: Document panics when allocations will exceed max)
 - rust-lang/rust#148811 (core docs: rewrite `panic::Location::caller` with visual line/column numbers)
 - rust-lang/rust#149101 (Improve mutable-binding suggestion to include name)
 - rust-lang/rust#149477 (float::maximum/minimum: make docs more streamlined)
 - rust-lang/rust#149547 (library: Rename `IterRange*` to `Range*Iter`)
 - rust-lang/rust#149548 (Generate delegation error body when delegation is not resolved)
 - rust-lang/rust#149630 (Check identifiers defined in macros when suggesting identifiers hidden by hygiene)
 - rust-lang/rust#149647 (Add regression test for 141845)
 - rust-lang/rust#149661 (Fix for LLVM22 making lowering decisions dependent on RuntimeLibraryInfo.)
 - rust-lang/rust#149666 (Add perma-unstable `--print=backend-has-zstd` for use by compiletest)
 - rust-lang/rust#149671 (interpret: test SNaN handling of float min/max and update comments)

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.

String methods do not acknowladge isize::MAX limit like Vec methods do

6 participants