Skip to content

Commit

Permalink
stabilize const_ascii_ctype_on_intrinsics
Browse files Browse the repository at this point in the history
  • Loading branch information
tspiteri committed Jun 29, 2020
1 parent 056d925 commit 2a84e31
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 23 deletions.
30 changes: 20 additions & 10 deletions src/libcore/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,8 @@ impl char {
/// assert!(!esc.is_ascii_alphabetic());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_alphabetic(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1261,7 +1262,8 @@ impl char {
/// assert!(!esc.is_ascii_uppercase());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_uppercase(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1297,7 +1299,8 @@ impl char {
/// assert!(!esc.is_ascii_lowercase());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_lowercase(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1336,7 +1339,8 @@ impl char {
/// assert!(!esc.is_ascii_alphanumeric());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_alphanumeric(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1372,7 +1376,8 @@ impl char {
/// assert!(!esc.is_ascii_digit());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_digit(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1411,7 +1416,8 @@ impl char {
/// assert!(!esc.is_ascii_hexdigit());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_hexdigit(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1451,7 +1457,8 @@ impl char {
/// assert!(!esc.is_ascii_punctuation());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_punctuation(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1487,7 +1494,8 @@ impl char {
/// assert!(!esc.is_ascii_graphic());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_graphic(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1540,7 +1548,8 @@ impl char {
/// assert!(!esc.is_ascii_whitespace());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_whitespace(&self) -> bool {
match *self {
Expand Down Expand Up @@ -1578,7 +1587,8 @@ impl char {
/// assert!(esc.is_ascii_control());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_control(&self) -> bool {
match *self {
Expand Down
1 change: 0 additions & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
#![feature(bound_cloned)]
#![feature(cfg_target_has_atomic)]
#![feature(concat_idents)]
#![feature(const_ascii_ctype_on_intrinsics)]
#![feature(const_alloc_layout)]
#![feature(const_discriminant)]
#![cfg_attr(bootstrap, feature(const_if_match))]
Expand Down
30 changes: 20 additions & 10 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4671,7 +4671,8 @@ impl u8 {
/// assert!(!esc.is_ascii_alphabetic());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_alphabetic(&self) -> bool {
matches!(*self, b'A'..=b'Z' | b'a'..=b'z')
Expand Down Expand Up @@ -4704,7 +4705,8 @@ impl u8 {
/// assert!(!esc.is_ascii_uppercase());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_uppercase(&self) -> bool {
matches!(*self, b'A'..=b'Z')
Expand Down Expand Up @@ -4737,7 +4739,8 @@ impl u8 {
/// assert!(!esc.is_ascii_lowercase());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_lowercase(&self) -> bool {
matches!(*self, b'a'..=b'z')
Expand Down Expand Up @@ -4773,7 +4776,8 @@ impl u8 {
/// assert!(!esc.is_ascii_alphanumeric());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_alphanumeric(&self) -> bool {
matches!(*self, b'0'..=b'9' | b'A'..=b'Z' | b'a'..=b'z')
Expand Down Expand Up @@ -4806,7 +4810,8 @@ impl u8 {
/// assert!(!esc.is_ascii_digit());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_digit(&self) -> bool {
matches!(*self, b'0'..=b'9')
Expand Down Expand Up @@ -4842,7 +4847,8 @@ impl u8 {
/// assert!(!esc.is_ascii_hexdigit());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_hexdigit(&self) -> bool {
matches!(*self, b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f')
Expand Down Expand Up @@ -4879,7 +4885,8 @@ impl u8 {
/// assert!(!esc.is_ascii_punctuation());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_punctuation(&self) -> bool {
matches!(*self, b'!'..=b'/' | b':'..=b'@' | b'['..=b'`' | b'{'..=b'~')
Expand Down Expand Up @@ -4912,7 +4919,8 @@ impl u8 {
/// assert!(!esc.is_ascii_graphic());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_graphic(&self) -> bool {
matches!(*self, b'!'..=b'~')
Expand Down Expand Up @@ -4962,7 +4970,8 @@ impl u8 {
/// assert!(!esc.is_ascii_whitespace());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_whitespace(&self) -> bool {
matches!(*self, b'\t' | b'\n' | b'\x0C' | b'\r' | b' ')
Expand Down Expand Up @@ -4997,7 +5006,8 @@ impl u8 {
/// assert!(esc.is_ascii_control());
/// ```
#[stable(feature = "ascii_ctype_on_intrinsics", since = "1.24.0")]
#[rustc_const_unstable(feature = "const_ascii_ctype_on_intrinsics", issue = "68983")]
#[rustc_const_stable(feature = "const_ascii_ctype_on_intrinsics", since = "1.46.0")]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn is_ascii_control(&self) -> bool {
matches!(*self, b'\0'..=b'\x1F' | b'\x7F')
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/consts/ascii_ctype.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// run-pass

#![feature(const_ascii_ctype_on_intrinsics)]

macro_rules! suite {
( $( $fn:ident => [$a:ident, $A:ident, $nine:ident, $dot:ident, $space:ident]; )* ) => {
$(
Expand Down

0 comments on commit 2a84e31

Please sign in to comment.