feat: Add NonZero::<T>::from_str_radix#151945
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Feb 6, 2026
Merged
Conversation
Contributor
Author
|
@rustbot label +T-libs-api -T-libs |
4 tasks
2ca5c91 to
104eae1
Compare
This comment has been minimized.
This comment has been minimized.
104eae1 to
d0aa337
Compare
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. |
Member
|
@bors r+ |
Contributor
TaKO8Ki
added a commit
to TaKO8Ki/rust
that referenced
this pull request
Feb 6, 2026
…tr-radix, r=Amanieu feat: Add `NonZero::<T>::from_str_radix` - Accepted ACP: rust-lang/libs-team#548 - Tracking issue: rust-lang#152193 This pull request adds a method to `NonZero<T>` that parses a non-zero integer from a string slice with digits in a given base. When using the combination of `int::from_str_radix` and `NonZero::<T>::new`, [`IntErrorKind::Zero`](https://doc.rust-lang.org/core/num/enum.IntErrorKind.html#variant.Zero) cannot be returned as an error. When using `NonZero::<T>::from_str`, `IntErrorKind::Zero` can be returned as an error, but this method cannot parse non-decimal integers. `NonZero::<T>::from_str_radix` can return `IntErrorKind::Zero` as an error, and can parse both decimal integers and non-decimal integers.
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 6, 2026
…tr-radix, r=Amanieu feat: Add `NonZero::<T>::from_str_radix` - Accepted ACP: rust-lang/libs-team#548 - Tracking issue: rust-lang#152193 This pull request adds a method to `NonZero<T>` that parses a non-zero integer from a string slice with digits in a given base. When using the combination of `int::from_str_radix` and `NonZero::<T>::new`, [`IntErrorKind::Zero`](https://doc.rust-lang.org/core/num/enum.IntErrorKind.html#variant.Zero) cannot be returned as an error. When using `NonZero::<T>::from_str`, `IntErrorKind::Zero` can be returned as an error, but this method cannot parse non-decimal integers. `NonZero::<T>::from_str_radix` can return `IntErrorKind::Zero` as an error, and can parse both decimal integers and non-decimal integers.
This was referenced Feb 6, 2026
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 6, 2026
…uwer Rollup of 6 pull requests Successful merges: - #151590 (cmse: don't use `BackendRepr` when checking return type) - #151945 (feat: Add `NonZero::<T>::from_str_radix`) - #152000 (Fix ICE in normalizing inherent associated consts with `#[type_const]`) - #152192 (Always use Xcode-provided Clang in macOS CI) - #152196 (bootstrap: Remove `ShouldRun::paths`) - #152222 (Re-add TaKO8Ki to triagebot review queue)
rust-timer
added a commit
that referenced
this pull request
Feb 6, 2026
Rollup merge of #151945 - sorairolake:feature/nonzero-from-str-radix, r=Amanieu feat: Add `NonZero::<T>::from_str_radix` - Accepted ACP: rust-lang/libs-team#548 - Tracking issue: #152193 This pull request adds a method to `NonZero<T>` that parses a non-zero integer from a string slice with digits in a given base. When using the combination of `int::from_str_radix` and `NonZero::<T>::new`, [`IntErrorKind::Zero`](https://doc.rust-lang.org/core/num/enum.IntErrorKind.html#variant.Zero) cannot be returned as an error. When using `NonZero::<T>::from_str`, `IntErrorKind::Zero` can be returned as an error, but this method cannot parse non-decimal integers. `NonZero::<T>::from_str_radix` can return `IntErrorKind::Zero` as an error, and can parse both decimal integers and non-decimal integers.
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.
NonZero::<T>::from_str_radixlibs-team#548nonzero_from_str_radix#152193This pull request adds a method to
NonZero<T>that parses a non-zero integer from a string slice with digits in a given base.When using the combination of
int::from_str_radixandNonZero::<T>::new,IntErrorKind::Zerocannot be returned as an error. When usingNonZero::<T>::from_str,IntErrorKind::Zerocan be returned as an error, but this method cannot parse non-decimal integers.NonZero::<T>::from_str_radixcan returnIntErrorKind::Zeroas an error, and can parse both decimal integers and non-decimal integers.