Commit Graph

62 Commits

Author SHA1 Message Date
kennytm
8e3493d459
Rollup merge of #47463 - bluss:fused-iterator, r=alexcrichton
Stabilize FusedIterator

FusedIterator is a marker trait that promises that the implementing
iterator continues to return `None` from `.next()` once it has returned
`None` once (and/or `.next_back()`, if implemented).

The effects of FusedIterator are already widely available through
`.fuse()`, but with stable `FusedIterator`, stable Rust users can
implement this trait for their iterators when appropriate.

Closes #35602
2018-03-06 20:52:37 +08:00
Ulrik Sverdrup
c7c23fe948 core: Update stability attributes for FusedIterator 2018-03-03 14:23:05 +01:00
Ulrik Sverdrup
bc651cac8d core: Stabilize FusedIterator
FusedIterator is a marker trait that promises that the implementing
iterator continues to return `None` from `.next()` once it has returned
`None` once (and/or `.next_back()`, if implemented).

The effects of FusedIterator are already widely available through
`.fuse()`, but with stable `FusedIterator`, stable Rust users can
implement this trait for their iterators when appropriate.
2018-03-03 14:14:03 +01:00
M Farkas-Dyck
5ac4f62f38 impl Clone for ::std_unicode::char::{ToLowercase, ToUppercase} 2018-02-28 20:58:16 -08:00
Nathan Ringo
64236092e5
Fixes docs for ASCII functions to no longer claim U+0021 is '@'. 2018-02-24 23:48:51 -06:00
Carol (Nichols || Goulding)
e168aa385b
Reexport -> re-export in prose and documentation comments 2018-01-15 13:36:53 -05:00
Clar Charr
b4b3ddd59e Move static code outside of unciode.py. 2018-01-02 22:51:22 -05:00
bors
3a0b652846 Auto merge of #46411 - rillian:str_ascii, r=kennytm
Mark ascii methods on primitive types stable in 1.23.0 not 1.21.0.

The ascii_methods_on_intrinsics feature stabilization
didn't land in time for 1.21.0. Update the annotation
so the documentation is correct about when these
methods became available.
2017-12-12 03:30:43 +00:00
Matt Brubeck
3024c1434a Use Try syntax for Option in place of macros or match 2017-12-09 14:18:33 -08:00
Corey Farwell
fcf1e73647 Rollup merge of #46432 - tromey:doc-fix-46307, r=estebank
Fix documentation for DecodeUtf16Error

Fixes #46307
2017-12-03 17:43:45 -05:00
Ralph Giles
6aef5e3b2e Mark ascii methods on primitive types stable in 1.23.0.
The ascii_methods_on_intrinsics feature stabilization
didn't land in time for 1.21.0. Update the annotation
so the documentation is correct about when these
methods became available.
2017-12-02 10:41:08 -08:00
Tom Tromey
47acc4bd84 Fix documentation for DecodeUtf16Error
Fixes #46307
2017-12-01 11:33:42 -07:00
kennytm
963ab91dd4 Rollup merge of #46077 - LukasKalbertodt:stabilize-ascii-ctype, r=alexcrichton
Stabilize some `ascii_ctype` methods

As discussed in #39658, this PR stabilizes those methods for `u8` and `char`. All inherent `ascii_ctype` for `[u8]` and `str` are removed as we prefer the more explicit version `s.chars().all(|c| c.is_ascii_())`.

This PR doesn't modify the `AsciiExt` trait. There, the `ascii_ctype` methods are still unstable. It is planned to remove those in the future (I think). I had to modify some code in `ascii.rs` to properly implement `AsciiExt` for all types.

Fixes #39658.
2017-11-29 18:37:44 +08:00
Lukas Kalbertodt
c5aad96739 Change since attribute from ctype methods from 1.23 to 1.24
The changes didn't land in time for 1.23 and stabilizations won't
be backported to beta.
2017-11-28 08:50:40 +01:00
Oliver Middleton
fb094642e1 Add missing Debug impls to std_unicode
Also adds #![deny(missing_debug_implementations)] so they don't get
missed again.
2017-11-22 00:49:28 +00:00
Lukas Kalbertodt
03370177ca Stabilize ascii_ctype methods for u8 and char
The feature of those methods was renamed to "ascii_ctype_on_intrinsics".
2017-11-18 17:30:16 +01:00
Collin Anderson
261d4d8185 fix some python3 incompatibilities 2017-11-16 13:34:13 -05:00
kennytm
838a38365d
Fixed several pulldown warnings when documenting libstd. 2017-11-14 17:22:57 +08:00
Lukas Kalbertodt
259c125267 Mark several ascii methods as unstable again
We don't want to stabilize them now already. The goal of this set of
commits is just to add inherent methods to the four types. Stabilizing
all of those methods can be done later.
2017-11-03 21:28:04 +01:00
Lukas Kalbertodt
8a4fa742a1 Fix lists in doc comments for ascii methods of u8 and char 2017-11-03 21:27:40 +01:00
Lukas Kalbertodt
d425f8d226 Copy AsciiExt methods to char directly
This is done in order to deprecate AsciiExt eventually.
2017-11-03 21:27:40 +01:00
Behnam Esfahbod
86a79c9710 [libstd_unicode] Expose UnicodeVersion type
In <https://github.com/rust-lang/rust/pull/42998>, we added an
uninstantiable type for the internal `UNICODE_VERSION` value,
`UnicodeVersion`, but it was not made public to the outside of the
crate, resulting in the value becoming less useful. Here we make the
type accessible from the outside.

Also add a run-pass test to make sure the type and value can be accessed
as intended.
2017-09-18 20:39:17 -07:00
Clar Charr
4260e4395e impl Debug for SplitWhitespace. 2017-09-03 19:13:01 -04:00
Tamir Duberstein
b3f50caee0
*: remove crate_{name,type} attributes
Fixes #41701.
2017-08-25 16:18:21 -04:00
bors
528307ab1c Auto merge of #43830 - alexcrichton:path-display-regression, r=aturon
std: Respect formatting flags for str-like OsStr

Historically many `Display` and `Debug` implementations for `OsStr`-like
abstractions have gone through `String::from_utf8_lossy`, but this was updated
in #42613 to use an internal `Utf8Lossy` abstraction instead. This had the
unfortunate side effect of causing a regression (#43765) in code which relied on
these `fmt` trait implementations respecting the various formatting flags
specified.

This commit opportunistically adds back interpretation of formatting trait flags
in the "common case" where where `OsStr`-like "thing" is all valid utf-8 and can
delegate to the formatting implementation for `str`. This doesn't entirely solve
the regression as non-utf8 paths will format differently than they did before
still (in that they will not respect formatting flags), but this should solve
the regression for all "real world" use cases of paths and such. The door's also
still open for handling these flags in the future!

Closes #43765
2017-08-23 03:24:13 +00:00
Zack M. Davis
1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Alex Crichton
742ca0caf2 std: Respect formatting flags for str-like OsStr
Historically many `Display` and `Debug` implementations for `OsStr`-like
abstractions have gone through `String::from_utf8_lossy`, but this was updated
in #42613 to use an internal `Utf8Lossy` abstraction instead. This had the
unfortunate side effect of causing a regression (#43765) in code which relied on
these `fmt` trait implementations respecting the various formatting flags
specified.

This commit opportunistically adds back interpretation of formatting trait flags
in the "common case" where where `OsStr`-like "thing" is all valid utf-8 and can
delegate to the formatting implementation for `str`. This doesn't entirely solve
the regression as non-utf8 paths will format differently than they did before
still (in that they will not respect formatting flags), but this should solve
the regression for all "real world" use cases of paths and such. The door's also
still open for handling these flags in the future!

Closes #43765
2017-08-13 21:07:03 -07:00
bors
d69cdca153 Auto merge of #42998 - behnam:uni-ver-type, r=sfackler
[libstd_unicode] Change UNICODE_VERSION to use u32

Looks like there's no strong reason to keep these values at `u64`.

With the current plans for the Unicode Standard, `u8` should be enough for the next 200 years. To stay on the safe side, I'm using `u16` here. I don't see a reason to go with anything machine-dependent/more-efficient.
2017-08-08 06:48:45 +00:00
Alex Crichton
4c9c6e824b std: Stabilize char_escape_debug
Stabilizes:

* `<char>::escape_debug`
* `std::char::EscapeDebug`

Closes #35068
2017-07-25 07:09:31 -07:00
Behnam Esfahbod
42f886110a [libstd_unicode] Create UnicodeVersion type
Create named struct `UnicodeVersion` to use instead of tuple type for
`UNICODE_VERSION` value. This allows user to access the fields with
meaningful field names: `major`, `minor`, and `micro`.

Per request, an empty private field is added to the struct, so it can be
extended in the future without API breakage.
2017-07-21 12:09:02 -06:00
Behnam Esfahbod
7ebb6eedca [libstd_unicode] Change UNICODE_VERSION to use u32
Use `u32` for version components, as `u64` is just an overkill, and
`u32` is the default type for integers and the default type used for
regular internal numbers.

There's no expectation for Unicode Versions to even reach one thousand
in the next hundered years. This is different from *package versions*,
which may become something auto-generated and exceed human-friendly
range of integer values.
2017-07-21 11:59:23 -06:00
Oliver Middleton
f2566bbaeb Correct some stability attributes
These show up in rustdoc so need to be correct.
2017-07-10 02:07:29 +01:00
Behnam Esfahbod
a6994d7f3a [libstd_unicode] Upgrade to Unicode 10.0.0 2017-06-30 17:25:28 -06:00
Corey Farwell
4c43bc32b7 Rollup merge of #42271 - tinaun:charfromstr, r=alexcrichton
add `FromStr` Impl for `char`

fixes #24939.

is it possible to use pub(restricted) instead of using a stability attribute for the internal error representation? is it needed at all?
2017-06-20 16:28:25 -04:00
tinaun
fd9d7aa2cf added FromStr Impl for char 2017-06-20 04:38:02 -04:00
Corey Farwell
6062bf7aca Rollup merge of #42705 - est31:master, r=alexcrichton
Introduce tidy lint to check for inconsistent tracking issues

This PR
* Refactors the collect_lib_features function to work in a
      non-checking mode (no bad pointer needed, and list of
      lang features).
* Introduces checking whether unstable/stable tags for a
      given feature have inconsistent tracking issues, as in,
      multiple tracking issues per feature.
* Fixes such inconsistencies throughout the codebase.
2017-06-16 23:10:50 -07:00
est31
c6afde6c46 Introduce tidy lint to check for inconsistent tracking issues
This commit
    * Refactors the collect_lib_features function to work in a
      non-checking mode (no bad pointer needed, and list of
      lang features).
    * Introduces checking whether unstable/stable tags for a
      given feature have inconsistent tracking issues.
    * Fixes such inconsistencies throughout the codebase.
2017-06-16 20:40:40 +02:00
Stepan Koltsov
ea149b8571 Utf8Lossy type with chunks iterator and impl Display and Debug 2017-06-15 20:42:35 +01:00
Murarth
eadda7665e Merge crate collections into alloc 2017-06-13 23:37:34 -07:00
bors
58b33ad70c Auto merge of #41659 - bluss:clone-split-whitespace, r=aturon
impl Clone for .split_whitespace()

Use custom closure structs for the predicates so that the iterator's
clone can simply be derived. This should also reduce virtual call
overhead by not using function pointers.

Fixes #41655
2017-05-10 03:27:36 +00:00
Corey Farwell
ed1b78c16b Move unicode Python script into libstd_unicode crate.
The only place this Python script is used is inside the libstd_unicode
crate, so lets move it there.
2017-05-04 22:37:55 -04:00
Ulrik Sverdrup
41aeb9d4ec std_unicode: Use #[inline] on the split_whitespace predicates 2017-04-30 21:24:47 +02:00
Ulrik Sverdrup
f41ecef6d5 std_unicode: impl Clone for .split_whitespace()
Use custom closure structs for the predicates so that the iterator's
clone can simply be derived. This should also reduce virtual call
overhead by not using function pointers.
2017-04-30 21:20:20 +02:00
Donnie Bishop
3b396217b5 Remove parentheses in method references 2017-03-30 18:33:23 -04:00
Donnie Bishop
c4b11d19b8 Revert SplitWhitespace's description
Original headline of SplitWhitespace's description is more descriptive as to what it contains and iterates over.
2017-03-30 16:46:16 -04:00
Donnie Bishop
a4a7166fd5 Modify SplitWhitespace's description 2017-03-30 16:36:06 -04:00
Colin Wallace
188299e04a char::to_uppercase doc typo: use the 'an' article. 2017-03-25 15:58:35 -07:00
Colin Wallace
53b70953c3 char::to_uppercase doc typo: s/lowercase/uppercase/ 2017-03-25 15:46:13 -07:00
Corey Farwell
e389f6a67e Rollup merge of #40499 - ericfindlay:master, r=steveklabnik
Corrected very minor documentation detail about Unicode and Japanese

Japanese half-width and full-width romaji characters do have upper and lowercase according Unicode (but other Japanese characters do not). For example,
` assert_eq!('\u{FF21}'.to_lowercase().collect::<String>(),"\u{FF41}");`

r? @steveklabnik
2017-03-17 08:49:00 -04:00
Eric Findlay
18a8494485 Ammended minor documentation detail abour Unicode cases. 2017-03-15 10:05:55 +09:00