-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Vec.resize(), Vec.resize_with() should be marked as panicking if the new capacity exceeds isize::MAX bytes #117437
Copy link
Copy link
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Location
In the documentation for the following functions:
alloc::vec::Vec.resize()alloc::vec::Vec.resize_with()I noted some trait impls where they might want to be added (such as the
Extendtrait impls onVec), but I'm unsure if it makes sense for the "Panics" notes to be added to them.Summary
These should be marked with the following:
as they all, in one way or another, call
Vec.reserve(), which itself will panic if the new capacity exceedsisize::MAXbytes.Because other functions that call
Vec.reserve()(such asVec.push()orVec::with_capacity()) are marked with this "Panics" note, not marking these could result in confusion - namely, the user might think that these functions somehow allow bypassing theisize::MAXbyte limit.