Skip to content

fix: use try_shrink instead of shrink in try_resize#20424

Merged
jonahgao merged 1 commit intoapache:mainfrom
ariel-miculas:use-try-shrink
Mar 4, 2026
Merged

fix: use try_shrink instead of shrink in try_resize#20424
jonahgao merged 1 commit intoapache:mainfrom
ariel-miculas:use-try-shrink

Conversation

@ariel-miculas
Copy link
Contributor

Which issue does this PR close?

No issue

Rationale for this change

The try_ functions should return errors instead of panicking.

What changes are included in this PR?

use try_shrink instead of shrink

Are these changes tested?

No, try_shrink is already tested.

Are there any user-facing changes?

No

@github-actions github-actions bot added the execution Related to the execution crate label Feb 18, 2026
@xanderbailey
Copy link
Contributor

Do you have an example of when shrink fails in this case?

@ariel-miculas
Copy link
Contributor Author

I don't have any example of when this can happen, it's just that shrink Panics if capacity exceeds [Self::size], whereas try_shrink returns an error

Copy link
Member

@jonahgao jonahgao left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @ariel-miculas

@jonahgao jonahgao added this pull request to the merge queue Mar 4, 2026
Merged via the queue into apache:main with commit 2cbee47 Mar 4, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execution Related to the execution crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants