Stabilize const {integer}::from_str_radix
i.e. const_int_from_str
#124941
+7
−9
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.
This PR stabilizes the feature
const_int_from_str
.FromStr
trait usage in const fn #59133API Change Diff:
This makes it easier to parse integers at compile-time, e.g.
the example from the Tracking Issue:
could now be achived with
rather than having to depend on a library that implements or manually implement the parsing at compile-time.
Checklist based on Libs Stabilization Guide - When there's const involved
I am treating this as a partial stabilization as it shares a tracking issue (and is rather small), so directly opening the partial stabilization PR for the subset (feature
const_int_from_str
) being stabilized.#[allow_internal_unstable]
used for access to internalcan_not_overflow
.can_not_overflow
, which is an internal const fn. And it should be Ok as that function could just be inlined to remove the internally unstable call.intrinsic::const_eval_select
Tracking Issue for const_eval_select #124625 infrom_str_radix_assert
to change the error message between compile-time and run-time