Skip to content

Commit

Permalink
Mark several ascii methods as unstable again
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LukasKalbertodt committed Nov 3, 2017
1 parent da57580 commit 259c125
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 40 deletions.
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
#![cfg_attr(not(test), feature(generator_trait))]
#![cfg_attr(test, feature(rand, test))]
#![feature(allow_internal_unstable)]
#![feature(ascii_ctype)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(cfg_target_has_atomic)]
Expand Down
20 changes: 10 additions & 10 deletions src/liballoc/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1631,23 +1631,23 @@ impl [u8] {
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphabetic(&self) -> bool {
self.iter().all(|b| b.is_ascii_alphabetic())
}

/// Checks if all bytes of this slice are ASCII uppercase characters:
/// U+0041 'A' ... U+005A 'Z'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_uppercase(&self) -> bool {
self.iter().all(|b| b.is_ascii_uppercase())
}

/// Checks if all bytes of this slice are ASCII lowercase characters:
/// U+0061 'a' ... U+007A 'z'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_lowercase(&self) -> bool {
self.iter().all(|b| b.is_ascii_lowercase())
Expand All @@ -1658,15 +1658,15 @@ impl [u8] {
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z', or
/// - U+0030 '0' ... U+0039 '9'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphanumeric(&self) -> bool {
self.iter().all(|b| b.is_ascii_alphanumeric())
}

/// Checks if all bytes of this slice are ASCII decimal digit:
/// U+0030 '0' ... U+0039 '9'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_digit(&self) -> bool {
self.iter().all(|b| b.is_ascii_digit())
Expand All @@ -1677,7 +1677,7 @@ impl [u8] {
/// - U+0030 '0' ... U+0039 '9', or
/// - U+0041 'A' ... U+0046 'F', or
/// - U+0061 'a' ... U+0066 'f'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_hexdigit(&self) -> bool {
self.iter().all(|b| b.is_ascii_hexdigit())
Expand All @@ -1689,15 +1689,15 @@ impl [u8] {
/// - U+003A ... U+0040 `: ; < = > ? @`, or
/// - U+005B ... U+0060 `[ \\ ] ^ _ \``, or
/// - U+007B ... U+007E `{ | } ~`
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_punctuation(&self) -> bool {
self.iter().all(|b| b.is_ascii_punctuation())
}

/// Checks if all bytes of this slice are ASCII graphic characters:
/// U+0021 '@' ... U+007E '~'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_graphic(&self) -> bool {
self.iter().all(|b| b.is_ascii_graphic())
Expand All @@ -1722,7 +1722,7 @@ impl [u8] {
/// [infra-aw]: https://infra.spec.whatwg.org/#ascii-whitespace
/// [pct]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_01
/// [bfs]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_whitespace(&self) -> bool {
self.iter().all(|b| b.is_ascii_whitespace())
Expand All @@ -1735,7 +1735,7 @@ impl [u8] {
///
/// Note that most ASCII whitespace characters are control
/// characters, but SPACE is not.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_control(&self) -> bool {
self.iter().all(|b| b.is_ascii_control())
Expand Down
24 changes: 14 additions & 10 deletions src/liballoc/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,7 @@ impl str {
///
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphabetic(&self) -> bool {
self.bytes().all(|b| b.is_ascii_alphabetic())
Expand All @@ -2217,6 +2217,8 @@ impl str {
/// # Example
///
/// ```
/// #![feature(ascii_ctype)]
///
/// // Only ascii uppercase characters
/// assert!("HELLO".is_ascii_uppercase());
///
Expand All @@ -2226,7 +2228,7 @@ impl str {
/// // While all characters are uppercase, 'Ü' is not ascii
/// assert!(!"TSCHÜSS".is_ascii_uppercase());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_uppercase(&self) -> bool {
self.bytes().all(|b| b.is_ascii_uppercase())
Expand All @@ -2238,6 +2240,8 @@ impl str {
/// # Example
///
/// ```
/// #![feature(ascii_ctype)]
///
/// // Only ascii uppercase characters
/// assert!("hello".is_ascii_lowercase());
///
Expand All @@ -2247,7 +2251,7 @@ impl str {
/// // While all characters are lowercase, 'Ü' is not ascii
/// assert!(!"tschüss".is_ascii_lowercase());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_lowercase(&self) -> bool {
self.bytes().all(|b| b.is_ascii_lowercase())
Expand All @@ -2259,15 +2263,15 @@ impl str {
/// - U+0041 'A' ... U+005A 'Z', or
/// - U+0061 'a' ... U+007A 'z', or
/// - U+0030 '0' ... U+0039 '9'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphanumeric(&self) -> bool {
self.bytes().all(|b| b.is_ascii_alphanumeric())
}

/// Checks if all characters of this string are ASCII decimal digit:
/// U+0030 '0' ... U+0039 '9'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_digit(&self) -> bool {
self.bytes().all(|b| b.is_ascii_digit())
Expand All @@ -2278,7 +2282,7 @@ impl str {
/// - U+0030 '0' ... U+0039 '9', or
/// - U+0041 'A' ... U+0046 'F', or
/// - U+0061 'a' ... U+0066 'f'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_hexdigit(&self) -> bool {
self.bytes().all(|b| b.is_ascii_hexdigit())
Expand All @@ -2291,15 +2295,15 @@ impl str {
/// - U+003A ... U+0040 `: ; < = > ? @`, or
/// - U+005B ... U+0060 `[ \\ ] ^ _ \``, or
/// - U+007B ... U+007E `{ | } ~`
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_punctuation(&self) -> bool {
self.bytes().all(|b| b.is_ascii_punctuation())
}

/// Checks if all characters of this string are ASCII graphic characters:
/// U+0021 '@' ... U+007E '~'.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_graphic(&self) -> bool {
self.bytes().all(|b| b.is_ascii_graphic())
Expand All @@ -2324,7 +2328,7 @@ impl str {
/// [infra-aw]: https://infra.spec.whatwg.org/#ascii-whitespace
/// [pct]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_01
/// [bfs]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_whitespace(&self) -> bool {
self.bytes().all(|b| b.is_ascii_whitespace())
Expand All @@ -2337,7 +2341,7 @@ impl str {
///
/// Note that most ASCII whitespace characters are control
/// characters, but SPACE is not.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_control(&self) -> bool {
self.bytes().all(|b| b.is_ascii_control())
Expand Down
40 changes: 30 additions & 10 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2416,7 +2418,7 @@ impl u8 {
/// assert!(!lf.is_ascii_alphabetic());
/// assert!(!esc.is_ascii_alphabetic());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphabetic(&self) -> bool {
if *self >= 0x80 { return false; }
Expand All @@ -2432,6 +2434,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2452,7 +2456,7 @@ impl u8 {
/// assert!(!lf.is_ascii_uppercase());
/// assert!(!esc.is_ascii_uppercase());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_uppercase(&self) -> bool {
if *self >= 0x80 { return false }
Expand All @@ -2468,6 +2472,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2488,7 +2494,7 @@ impl u8 {
/// assert!(!lf.is_ascii_lowercase());
/// assert!(!esc.is_ascii_lowercase());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_lowercase(&self) -> bool {
if *self >= 0x80 { return false }
Expand All @@ -2507,6 +2513,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2527,7 +2535,7 @@ impl u8 {
/// assert!(!lf.is_ascii_alphanumeric());
/// assert!(!esc.is_ascii_alphanumeric());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_alphanumeric(&self) -> bool {
if *self >= 0x80 { return false }
Expand All @@ -2543,6 +2551,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2563,7 +2573,7 @@ impl u8 {
/// assert!(!lf.is_ascii_digit());
/// assert!(!esc.is_ascii_digit());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_digit(&self) -> bool {
if *self >= 0x80 { return false }
Expand All @@ -2582,6 +2592,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2602,7 +2614,7 @@ impl u8 {
/// assert!(!lf.is_ascii_hexdigit());
/// assert!(!esc.is_ascii_hexdigit());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_hexdigit(&self) -> bool {
if *self >= 0x80 { return false }
Expand All @@ -2622,6 +2634,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2642,7 +2656,7 @@ impl u8 {
/// assert!(!lf.is_ascii_punctuation());
/// assert!(!esc.is_ascii_punctuation());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_punctuation(&self) -> bool {
if *self >= 0x80 { return false }
Expand All @@ -2658,6 +2672,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2678,7 +2694,7 @@ impl u8 {
/// assert!(!lf.is_ascii_graphic());
/// assert!(!esc.is_ascii_graphic());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_graphic(&self) -> bool {
if *self >= 0x80 { return false; }
Expand Down Expand Up @@ -2711,6 +2727,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2731,7 +2749,7 @@ impl u8 {
/// assert!(lf.is_ascii_whitespace());
/// assert!(!esc.is_ascii_whitespace());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_whitespace(&self) -> bool {
if *self >= 0x80 { return false; }
Expand All @@ -2749,6 +2767,8 @@ impl u8 {
/// # Examples
///
/// ```
/// #![feature(ascii_ctype)]
///
/// let uppercase_a = b'A';
/// let uppercase_g = b'G';
/// let a = b'a';
Expand All @@ -2769,7 +2789,7 @@ impl u8 {
/// assert!(lf.is_ascii_control());
/// assert!(esc.is_ascii_control());
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[unstable(feature = "ascii_ctype", issue = "39658")]
#[inline]
pub fn is_ascii_control(&self) -> bool {
if *self >= 0x80 { return false; }
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
html_playground_url = "https://play.rust-lang.org/")]
#![deny(warnings)]

#![feature(ascii_ctype)]
#![feature(rustc_private)]
#![feature(box_patterns)]
#![feature(box_syntax)]
Expand Down
Loading

0 comments on commit 259c125

Please sign in to comment.