deprecate std::char constants and functions#153873
deprecate std::char constants and functions#153873folkertdev wants to merge 1 commit intorust-lang:mainfrom
std::char constants and functions#153873Conversation
3d35ff3 to
00b5d46
Compare
std::char::MAXstd::char constants and functions
This comment has been minimized.
This comment has been minimized.
| /// The maximum number of bytes required to [encode](char::encode_utf8) a `char` to | ||
| /// UTF-8 encoding. | ||
| #[unstable(feature = "char_max_len", issue = "121714")] | ||
| pub const MAX_LEN_UTF8: usize = char::MAX_LEN_UTF8; | ||
|
|
||
| /// The maximum number of two-byte units required to [encode](char::encode_utf16) a `char` | ||
| /// to UTF-16 encoding. | ||
| #[unstable(feature = "char_max_len", issue = "121714")] | ||
| pub const MAX_LEN_UTF16: usize = char::MAX_LEN_UTF16; |
There was a problem hiding this comment.
There is currently no core::char::consts module, so currently these constants are just gone. Should they be added as associated consts, or should that core::char::consts module be added?
There was a problem hiding this comment.
note to self: the consts being gone completely is the cause of the char_max_len CI failure.
There was a problem hiding this comment.
They already are associated consts: https://doc.rust-lang.org/stable/std/primitive.char.html#associatedconstant.MAX_LEN_UTF8
And were stabilized under the feature char_max_len_assoc
There was a problem hiding this comment.
Nice, these can probably just be removed then.
similar to how constants in those modules for numeric types have been deprecated
00b5d46 to
ee9b61c
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rfcbot merge libs-api |
|
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
similar to how constants in those modules for numeric types have been deprecated. The
std::charmodule contains:Three stable constants that this PR deprecates. These already link to their method equivalents.
MAXREPLACEMENT_CHARACTERUNICODE_VERSIONtwo unstable constants that this PR removes. The constants are already stablized as associated constants on
char.MAX_LEN_UTF8MAX_LEN_UTF16Four stable functions that this PR deprecates. These already link to their method equivalents.
fn decode_utf16fn from_digitfn from_u32fn from_u32_unchecked⚠discussion at #t-libs > should `std::char::{MIN, MAX}` be deprecated?.
r? libs-api