about summary refs log tree commit diff
path: root/src/libcore/char
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-2639/+0
2020-07-27Rollup merge of #73858 - tspiteri:const-methods, r=oli-obkManish Goregaokar-10/+10
Make more primitive integer methods const Now that #72437 has been merged and `const_if_match` is stable, these methods can be stabilized const. The methods are grouped in commits according to feature names: * `const_nonzero_int_methods` - `NonZero*::new` * some `const_checked_int_methods` - `{i*,u*}::checked_add` - `{i*,u*}::checked_sub` - `{i*,u*}::checked_mul` - `{i*,u*}::checked_neg` - `{i*,u*}::checked_shl` - `{i*,u*}::checked_shr` - `i*::checked_abs` * `const_saturating_int_methods` - `{i*,u*}::saturating_add` - `{i*,u*}::saturating_sub` - `{i*,u*}::saturating_mul` - `i*::saturating_neg` - `i*::saturating_abs` * `const_int_sign` - `i*::signum` * `const_ascii_ctype_on_intrinsics` - `{char,u8}::is_ascii_alphabetic` - `{char,u8}::is_ascii_uppercase` - `{char,u8}::is_ascii_lowercase` - `{char,u8}::is_ascii_alphanumeric` - `{char,u8}::is_ascii_digit` - `{char,u8}::is_ascii_hexdigit` - `{char,u8}::is_ascii_punctuation` - `{char,u8}::is_ascii_graphic` - `{char,u8}::is_ascii_whitespace` - `{char,u8}::is_ascii_control`
2020-07-22mark methods as constant since 1.47.0 instead of 1.46.0Trevor Spiteri-20/+10
2020-06-30Deny unsafe ops in unsafe fns, part 6LeSeulArtichaut-4/+0
And final part!!!
2020-06-30Deny unsafe ops in unsafe fns, part 1LeSeulArtichaut-2/+8
2020-06-29stabilize const_ascii_ctype_on_intrinsicsTrevor Spiteri-10/+20
2020-06-13Adjusted some doctests in libcore to use `should_panic`.Jake Degen-53/+20
Previously, some doctests were spawning new threads and joining them to indicate that a particular call should panic; this hurt readability, so the tests have been adjusted to simply call the method and use the `should_panic` marker.
2020-05-30encode_utf8_raw is not always valid UTF-8; clarify commentsRalf Jung-7/+12
2020-05-30also expose and use encode_utf16_raw for wtf8Ralf Jung-22/+39
2020-05-30expose char::encode_utf8_raw for libstdRalf Jung-40/+63
2020-05-28from_u32_unchecked: check validity when debug assertions are enabledRalf Jung-2/+2
2020-05-21Rollup merge of #72371 - Elrendio:char_documentation, r=steveklabnikRalf Jung-2/+4
FIX - Char documentation for unexperienced users This is my first PR on rust and even if I've read [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure. **What it does:** - Add an example in the char documentation **Explanation** Unexperienced users might not know that punctuation is `Case_Ignorable` and not `Uppercase` and `Lowercase` which mean that when checking if a string is uppercase one might be tempted to write: ```rust my_string.chars().all(char::is_uppercase) ``` However this will return false for `"HELLO WORLD"` which is not intuitive. Since the function `is_case_ignorable` doesn't exists I believe the correct way to check is: ```rust !my_string.chars().any(char::is_lowercase) ``` The aim of this example is to prevent unexperienced users to make an error which punctuation chars.
2020-05-20FIX - Char documentation for unexperienced usersElrendio-2/+4
2020-05-03Try to fix doc links in new `char` methods.Eduardo Sánchez Muñoz-16/+13
2020-05-03Make `std::char` functions and constants associated to `char`.Eduardo Sánchez Muñoz-2/+242
2020-04-23Stabilize UNICODE_VERSION (feature unicode_version)Pyfisch-3/+1
The feature will become stable in Rust 1.45. Noted that the value of UNICODE_VERSION is expected to change.
2020-04-11Store UNICODE_VERSION as a tuplePyfisch-2/+0
Remove the UnicodeVersion struct containing major, minor and update fields and replace it with a 3-tuple containing the version number. As the value of each field is limited to 255 use u8 to store them.
2020-02-11Improve `char::is_ascii_*` codeAndrea Canciani-10/+40
These methods explicitly check if a char is in a specific ASCII range, therefore the `is_ascii()` check is not needed, but LLVM seems to be unable to remove it. WARNING: this change improves the performance on ASCII `char`s, but complex checks such as `is_ascii_punctuation` become slower on non-ASCII `char`s.
2020-02-08Make the ASCII ctype inherent methods constDylan MacKenzie-10/+20
2020-01-14Replace old tables with new unicode dataMark Rousskov-10/+10
2019-12-23Minimize unsafety in encode_utf8Mark Rousskov-30/+29
Use slice patterns to avoid having to skip bounds checking
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-1/+1
2019-12-18Propagate cfg bootstrapMark Rousskov-4/+1
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+4
functions with a `const` modifier
2019-12-11Some small readability improvementsAndre Bogus-10/+5
2019-11-26Format libcore with rustfmtDavid Tolnay-83/+57
This commit applies rustfmt with default settings to files in src/libcore *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in `outstanding_files`, the relevant commands were: $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018 $ rg libcore outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libcore.
2019-11-06Have tidy ensure that we document all `unsafe` blocks in libcoreOliver Scherer-1/+5
2019-10-12Improve docs on some char boolean methodsBO41-63/+109
2019-10-01Remove unneeded `fn main` blocks from docsLzu Tao-34/+32
2019-09-04remove XID and Pattern_White_Space unicode tables from libcoreAleksey Kladov-23/+0
They are only used by rustc_lexer, and are not needed elsewhere. So we move the relevant definitions into rustc_lexer (while the actual unicode data comes from the unicode-xid crate) and make the rest of the compiler use it.
2019-08-14Handle cfg(bootstrap) throughoutMark Rousskov-12/+2
2019-07-25Fix inconsistent highlight blocks.Tomasz Różański-7/+7
2019-07-22add rustc_private as a proper language feature gateAleksey Kladov-7/+12
At the moment, `rustc_private` as a (library) feature exists by accident: `char::is_xid_start`, `char::is_xid_continue` methods in libcore define it.
2019-06-30fix the same typo in doctestlcolaholicl-2/+2
2019-06-30Fix a typolcolaholicl-1/+1
Fix a typo in `libcore/char/methods.rs`
2019-06-14Change `...` to `..=` where applicableAaron Kutch-18/+18
2019-04-19libcore: deny more...Mazdak Farrokhzad-10/+9
2019-04-18libcore => 2018Taiki Endo-13/+16
2019-03-19Rollup merge of #58778 - xfix:exact_size_case_mapping_iter, r=SimonSapinMazdak Farrokhzad-0/+22
Implement ExactSizeIterator for ToLowercase and ToUppercase
2019-03-19Update since annotation for ExactSizeIterator for ToUppercase/LowercaseKonrad Borowski-2/+2
This functionality was added in 1.35.0, not 1.34.0.
2019-02-27Implement ExactSizeIterator for ToLowercase and ToUppercaseKonrad Borowski-0/+22
2019-02-13Stabilize TryFrom and TryIntoSimon Sapin-4/+4
2019-02-12Auto merge of #58051 - SimonSapin:str_escape, r=alexcrichtonbors-3/+1
Stabilize str::escape_* methods with new return types… … that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: https://github.com/rust-lang/rust/issues/27791#issuecomment-376864727
2019-02-12Make the prema-unstable char::escape_debug_ext method crate-privateSimon Sapin-3/+1
2019-02-10libs: doc commentsAlexander Regueiro-11/+11
2018-12-25Remove licensesMark Rousskov-40/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-11-21update various stdlib docsSteve Klabnik-4/+2
2018-11-14core/char: Add comment to `to_digit()`Tobias Bieniek-0/+3
2018-11-14core/char: Drop `radix == 10` special caseTobias Bieniek-8/+1
This seems to perform equally well