Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]> - #159864
Merged
rust-bors[bot] merged 1 commit intoAug 1, 2026
Conversation
Constructing an Rc<[T]> or Arc<[T]> whose header + payload layout exceeds isize::MAX unwrapped a LayoutError, panicking with the opaque "called `Result::unwrap()` on an `Err` value: LayoutError". Match Vec and Box by reporting "capacity overflow" instead, and add regression tests.
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @JohnTitor (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Aug 1, 2026
…overflow, r=JohnTitor Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]> Fixes rust-lang#136797. Building an Rc<[T]>/Arc<[T]> whose header + payload layout exceeds isize::MAX unwrapped a LayoutError and panicked with "called Result::unwrap() on an Err value: LayoutError". Vec and Box report "capacity overflow" here; this makes Rc/Arc do the same. Used an inline panic!("capacity overflow") rather than raw_vec's capacity_overflow(), since that helper is cfg'd out under no_global_oom_handling while these two layout fns still compile there.
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Aug 1, 2026
…overflow, r=JohnTitor Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]> Fixes rust-lang#136797. Building an Rc<[T]>/Arc<[T]> whose header + payload layout exceeds isize::MAX unwrapped a LayoutError and panicked with "called Result::unwrap() on an Err value: LayoutError". Vec and Box report "capacity overflow" here; this makes Rc/Arc do the same. Used an inline panic!("capacity overflow") rather than raw_vec's capacity_overflow(), since that helper is cfg'd out under no_global_oom_handling while these two layout fns still compile there.
This was referenced Aug 1, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
Aug 1, 2026
Rollup of 14 pull requests Successful merges: - #159245 (Emit retags in codegen to support BorrowSanitizer (part 5)) - #159864 (Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>) - #160079 (make atomic operations const) - #160124 (Structurally prevent zero-count `BackendRepr::SimdVector`s) - #160162 (Make `#[fundamental]` only apply to the first argument of `Box`) - #160210 (Remove an outdated FIXME) - #160282 (Improve diagnostic for patterns in function pointer types) - #157928 (Eagerly fetch typeck results when linting) - #159672 (Improve suggestions when multiples tuples implement the same trait) - #159861 (Add documentation for the `non_exhaustive` attribute) - #159907 (Fix `hidden_glob_reexports` in `rustc_ast`) - #159998 (Align expect messages with guidance) - #160145 (Expand checks for register_tool) - #160307 (Update `minifier` version to `0.4.0`)
rust-timer
added a commit
that referenced
this pull request
Aug 1, 2026
Rollup merge of #159864 - zakrad:fix-136797-rc-arc-capacity-overflow, r=JohnTitor Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]> Fixes #136797. Building an Rc<[T]>/Arc<[T]> whose header + payload layout exceeds isize::MAX unwrapped a LayoutError and panicked with "called Result::unwrap() on an Err value: LayoutError". Vec and Box report "capacity overflow" here; this makes Rc/Arc do the same. Used an inline panic!("capacity overflow") rather than raw_vec's capacity_overflow(), since that helper is cfg'd out under no_global_oom_handling while these two layout fns still compile there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #136797.
Building an Rc<[T]>/Arc<[T]> whose header + payload layout exceeds
isize::MAX unwrapped a LayoutError and panicked with "called
Result::unwrap() on an Err value: LayoutError". Vec and Box report
"capacity overflow" here; this makes Rc/Arc do the same.
Used an inline panic!("capacity overflow") rather than raw_vec's
capacity_overflow(), since that helper is cfg'd out under
no_global_oom_handling while these two layout fns still compile there.