Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue for FromStr trait usage in const fn #59133

Open
elichai opened this issue Mar 12, 2019 · 1 comment
Open

Tracking issue for FromStr trait usage in const fn #59133

elichai opened this issue Mar 12, 2019 · 1 comment
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@elichai
Copy link
Contributor

elichai commented Mar 12, 2019

Because Rust already have macros that evaluate on compile time to strings I think converting them to ints in a const fn is a very nice feature.

e.g. env!("SOMETHING").parse::<usize>().unwrap()


I opened this Issue as part of: #57563
Interested to hear if other people want this and if it's already exists as part of a different issue/RFC

@jonas-schievink jonas-schievink added A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Mar 12, 2019
@Centril Centril added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Nov 6, 2019
@jonas-schievink
Copy link
Contributor

Isn't this just #67792 / rust-lang/rfcs#2632?

@Dylan-DPC Dylan-DPC added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. and removed C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Dec 4, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 30, 2024
Make {integer}::from_str_radix constant

This commit makes FromStr on integers constant so that `const x: u32 = "23".parse();` works. More practical use-case is with environment variables at build time as discussed in rust-lang/rfcs#1907.

Tracking issue rust-lang#59133.

ACP: rust-lang/libs-team#74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-fn Area: const fn foo(..) {..}. Pure functions which can be applied at compile time. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants