-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Make char conversion functions unstably const #89258
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
26c8990
to
4fe8247
Compare
This comment has been minimized.
This comment has been minimized.
4fe8247
to
b4a3875
Compare
b4a3875
to
e827eca
Compare
I admit that I feel a little "meh" about small const-ifications that also need to change the bodies of functions to make them amenable to const-ifying (or even extracting them into helper functions for sharing). It seems like there is no particularly pressing need to do so, and const-fn evaluation is progressing gradually to the point where that becomes less necessary to do. That said, this PR seems OK to me in isolation (and seems to match current policy...). r? @yaahc for libs-api approval |
☔ The latest upstream changes (presumably #89767) made this pull request unmergeable. Please resolve the merge conflicts. |
e827eca
to
7272b6f
Compare
@Mark-Simulacrum does this need libs-api approval? @oli-obk has recently r+'d a very similar PR #90607 without libs-api approval. |
I think current policy is const eval OR libs-api, but am not confident on that. |
wg-const-eval may unstably add const to functions without querying libs-api |
📌 Commit 7272b6f has been approved by |
Make char conversion functions unstably const The char conversion functions like `char::from_u32` do trivial computations and can easily be converted into const fns. Only smaller tricks are needed to avoid non-const standard library functions like `Result::ok` or `bool::then_some`. Tracking issue: rust-lang#89259
Rollup of 8 pull requests Successful merges: - rust-lang#89258 (Make char conversion functions unstably const) - rust-lang#90578 (add const generics test) - rust-lang#90633 (Refactor single variant `Candidate` enum into a struct) - rust-lang#90800 (bootstap: create .cargo/config only if not present) - rust-lang#90942 (windows: Return the "Not Found" error when a path is empty) - rust-lang#90947 (Move some tests to more reasonable directories - 9.5) - rust-lang#90961 (Suggest removal of arguments for unit variant, not replacement) - rust-lang#90990 (Arenas cleanup) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The char conversion functions like
char::from_u32
do trivial computations and can easily be converted into const fns. Only smaller tricks are needed to avoid non-const standard library functions likeResult::ok
orbool::then_some
.Tracking issue: #89259