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 associated functions and consts of std::char. #71763

Closed
eduardosm opened this issue May 1, 2020 · 6 comments · Fixed by #71854 or #82919
Closed

Tracking issue for associated functions and consts of std::char. #71763

eduardosm opened this issue May 1, 2020 · 6 comments · Fixed by #71854 or #82919
Assignees
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. 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

@eduardosm
Copy link
Contributor

The std::char module defines functions that could be instead associated methods of the char type (e.g., decode_utf16). Making them associated to the char type allows to use directly char::method instead of std::char::method. Similarly, the std::char::MAX and std::char::REPLACEMENT_CHARACTER could also be associated constants (like done with integer constants in #68952).

@jonas-schievink jonas-schievink added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels May 1, 2020
@eduardosm
Copy link
Contributor Author

I can help to implement to do this. This is what I would do:

  • Move the functions and constants into impl char and make them unstable (with features assoc_char_funcs and assoc_char_consts).
  • Implement the non-associated versions on top of the associated ones.

@eduardosm
Copy link
Contributor Author

Implement the non-associated versions on top of the associated ones.

Given the module structure inside the core::char module, I think it would be better to implement the associated functions on top of the other functions.

RalfJung added a commit to RalfJung/rust that referenced this issue May 21, 2020
…ts, r=Amanieu

Make `std::char` functions and constants associated to `char`.

First step to fix rust-lang#71763.
@bors bors closed this as completed in 25028ad May 21, 2020
@eduardosm
Copy link
Contributor Author

This is currently the issue pointed as tracking issue for the new features added in #71854, so this issue should be reopened or a proper tracking issue should be created.

@jonas-schievink jonas-schievink changed the title std::char functions and constants could be associated to the char type. Tracking issue for associated functions and consts of std::char. Aug 30, 2020
@jonas-schievink jonas-schievink added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. B-unstable Blocker: Implemented in the nightly compiler and unstable. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Aug 30, 2020
@kornelski
Copy link
Contributor

Are there any blockers to stabilizing this?

@gilescope
Copy link
Contributor

gilescope commented Feb 9, 2021

This would be great to stabilise as it trips new users up that the methods aren't available on char in stable rust at the moment.

@bstrie bstrie self-assigned this Mar 8, 2021
@bstrie
Copy link
Contributor

bstrie commented Mar 8, 2021

I'm assuming that no separate RFC is necessary here since, speaking as the author of RFC 2700, it was simple oversight on my part that the wannabe associated items on char were overlooked. I'll submit a stabilization PR for consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. 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
5 participants