| Age | Commit message (Collapse) | Author | Lines |
|
|
|
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`
|
|
|
|
And final part!!!
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
The feature will become stable in Rust 1.45.
Noted that the value of UNICODE_VERSION is expected to change.
|
|
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.
|
|
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.
|
|
|
|
|
|
Use slice patterns to avoid having to skip bounds checking
|
|
|
|
|
|
functions with a `const` modifier
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
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.
|
|
|
|
Fix a typo in `libcore/char/methods.rs`
|
|
|
|
|
|
|
|
Implement ExactSizeIterator for ToLowercase and ToUppercase
|
|
This functionality was added in 1.35.0, not 1.34.0.
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This seems to perform equally well
|