Skip to content

Make FromStr on integers const #74

Closed
@GKFX

Description

@GKFX

Proposal

Make FromStr on integers const, as well as the parse() method so that "12".parse::<u32>() is const. (Edit: and the u32::from_str_radix functions, since it's the same implementation.)

Problem statement

There is currently no convenient way to convert a numeric string into a an integer at compile time.

Motivation, use-cases

Reading numeric environment variables at compile time into integer constants.

Solution sketches

rust-lang/rust#99322

Links and related work

rust-lang/rfcs#1907
rust-lang/rust#59133

What happens now?

This issue is part of the libs-api team API change proposal process. Once this issue is filed the libs-api team will review open proposals in its weekly meeting. You should receive feedback within a week or two.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ACP-acceptedAPI Change Proposal is accepted (seconded with no objections)T-libs-apiapi-change-proposalA proposal to add or alter unstable APIs in the standard libraries

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions