Skip to content

Commit 04070d1

Browse files
Make ascii methods on u8 insta-stable
Those methods will shadow the methods of `AsciiExt`, so if we don't make them insta-stable, everyone will hitting stability errors. It is fine adding those as stable, because they are just being moved around [according to sfackler][1]. OPEN QUESTION: this commit also stabilizes the `AsciiExt` methods that were previously feature gated by the `ascii_ctype` feature. Maybe we don't want to stablilize those yet. [1]: #44042 (comment)
1 parent d3f2be4 commit 04070d1

File tree

1 file changed

+16
-48
lines changed

1 file changed

+16
-48
lines changed

src/libcore/num/mod.rs

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,15 +2264,13 @@ impl u8 {
22642264
/// # Examples
22652265
///
22662266
/// ```
2267-
/// #![feature(ascii_methods_on_intrinsics)]
2268-
///
22692267
/// let ascii = 97u8;
22702268
/// let non_ascii = 150u8;
22712269
///
22722270
/// assert!(ascii.is_ascii());
22732271
/// assert!(!non_ascii.is_ascii());
22742272
/// ```
2275-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2273+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
22762274
#[inline]
22772275
pub fn is_ascii(&self) -> bool {
22782276
*self & 128 == 0
@@ -2288,15 +2286,13 @@ impl u8 {
22882286
/// # Examples
22892287
///
22902288
/// ```
2291-
/// #![feature(ascii_methods_on_intrinsics)]
2292-
///
22932289
/// let lowercase_a = 97u8;
22942290
///
22952291
/// assert_eq!(65, lowercase_a.to_ascii_uppercase());
22962292
/// ```
22972293
///
22982294
/// [`make_ascii_uppercase`]: #method.make_ascii_uppercase
2299-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2295+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
23002296
#[inline]
23012297
pub fn to_ascii_uppercase(&self) -> u8 {
23022298
ASCII_UPPERCASE_MAP[*self as usize]
@@ -2312,15 +2308,13 @@ impl u8 {
23122308
/// # Examples
23132309
///
23142310
/// ```
2315-
/// #![feature(ascii_methods_on_intrinsics)]
2316-
///
23172311
/// let uppercase_a = 65u8;
23182312
///
23192313
/// assert_eq!(97, uppercase_a.to_ascii_lowercase());
23202314
/// ```
23212315
///
23222316
/// [`make_ascii_lowercase`]: #method.make_ascii_lowercase
2323-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2317+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
23242318
#[inline]
23252319
pub fn to_ascii_lowercase(&self) -> u8 {
23262320
ASCII_LOWERCASE_MAP[*self as usize]
@@ -2334,14 +2328,12 @@ impl u8 {
23342328
/// # Examples
23352329
///
23362330
/// ```
2337-
/// #![feature(ascii_methods_on_intrinsics)]
2338-
///
23392331
/// let lowercase_a = 97u8;
23402332
/// let uppercase_a = 65u8;
23412333
///
23422334
/// assert!(lowercase_a.eq_ignore_ascii_case(uppercase_a));
23432335
/// ```
2344-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2336+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
23452337
#[inline]
23462338
pub fn eq_ignore_ascii_case(&self, other: u8) -> bool {
23472339
self.to_ascii_lowercase() == other.to_ascii_lowercase()
@@ -2358,8 +2350,6 @@ impl u8 {
23582350
/// # Examples
23592351
///
23602352
/// ```
2361-
/// #![feature(ascii_methods_on_intrinsics)]
2362-
///
23632353
/// let mut byte = b'a';
23642354
///
23652355
/// byte.make_ascii_uppercase();
@@ -2368,7 +2358,7 @@ impl u8 {
23682358
/// ```
23692359
///
23702360
/// [`to_ascii_uppercase`]: #method.to_ascii_uppercase
2371-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2361+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
23722362
#[inline]
23732363
pub fn make_ascii_uppercase(&mut self) {
23742364
*self = self.to_ascii_uppercase();
@@ -2385,8 +2375,6 @@ impl u8 {
23852375
/// # Examples
23862376
///
23872377
/// ```
2388-
/// #![feature(ascii_methods_on_intrinsics)]
2389-
///
23902378
/// let mut byte = b'A';
23912379
///
23922380
/// byte.make_ascii_lowercase();
@@ -2395,7 +2383,7 @@ impl u8 {
23952383
/// ```
23962384
///
23972385
/// [`to_ascii_lowercase`]: #method.to_ascii_lowercase
2398-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2386+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
23992387
#[inline]
24002388
pub fn make_ascii_lowercase(&mut self) {
24012389
*self = self.to_ascii_lowercase();
@@ -2409,8 +2397,6 @@ impl u8 {
24092397
/// # Examples
24102398
///
24112399
/// ```
2412-
/// #![feature(ascii_methods_on_intrinsics)]
2413-
///
24142400
/// let uppercase_a = b'A';
24152401
/// let uppercase_g = b'G';
24162402
/// let a = b'a';
@@ -2431,7 +2417,7 @@ impl u8 {
24312417
/// assert!(!lf.is_ascii_alphabetic());
24322418
/// assert!(!esc.is_ascii_alphabetic());
24332419
/// ```
2434-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2420+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
24352421
#[inline]
24362422
pub fn is_ascii_alphabetic(&self) -> bool {
24372423
if *self >= 0x80 { return false; }
@@ -2447,8 +2433,6 @@ impl u8 {
24472433
/// # Examples
24482434
///
24492435
/// ```
2450-
/// #![feature(ascii_methods_on_intrinsics)]
2451-
///
24522436
/// let uppercase_a = b'A';
24532437
/// let uppercase_g = b'G';
24542438
/// let a = b'a';
@@ -2469,7 +2453,7 @@ impl u8 {
24692453
/// assert!(!lf.is_ascii_uppercase());
24702454
/// assert!(!esc.is_ascii_uppercase());
24712455
/// ```
2472-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2456+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
24732457
#[inline]
24742458
pub fn is_ascii_uppercase(&self) -> bool {
24752459
if *self >= 0x80 { return false }
@@ -2485,8 +2469,6 @@ impl u8 {
24852469
/// # Examples
24862470
///
24872471
/// ```
2488-
/// #![feature(ascii_methods_on_intrinsics)]
2489-
///
24902472
/// let uppercase_a = b'A';
24912473
/// let uppercase_g = b'G';
24922474
/// let a = b'a';
@@ -2507,7 +2489,7 @@ impl u8 {
25072489
/// assert!(!lf.is_ascii_lowercase());
25082490
/// assert!(!esc.is_ascii_lowercase());
25092491
/// ```
2510-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2492+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
25112493
#[inline]
25122494
pub fn is_ascii_lowercase(&self) -> bool {
25132495
if *self >= 0x80 { return false }
@@ -2525,8 +2507,6 @@ impl u8 {
25252507
/// # Examples
25262508
///
25272509
/// ```
2528-
/// #![feature(ascii_methods_on_intrinsics)]
2529-
///
25302510
/// let uppercase_a = b'A';
25312511
/// let uppercase_g = b'G';
25322512
/// let a = b'a';
@@ -2547,7 +2527,7 @@ impl u8 {
25472527
/// assert!(!lf.is_ascii_alphanumeric());
25482528
/// assert!(!esc.is_ascii_alphanumeric());
25492529
/// ```
2550-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2530+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
25512531
#[inline]
25522532
pub fn is_ascii_alphanumeric(&self) -> bool {
25532533
if *self >= 0x80 { return false }
@@ -2563,8 +2543,6 @@ impl u8 {
25632543
/// # Examples
25642544
///
25652545
/// ```
2566-
/// #![feature(ascii_methods_on_intrinsics)]
2567-
///
25682546
/// let uppercase_a = b'A';
25692547
/// let uppercase_g = b'G';
25702548
/// let a = b'a';
@@ -2585,7 +2563,7 @@ impl u8 {
25852563
/// assert!(!lf.is_ascii_digit());
25862564
/// assert!(!esc.is_ascii_digit());
25872565
/// ```
2588-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2566+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
25892567
#[inline]
25902568
pub fn is_ascii_digit(&self) -> bool {
25912569
if *self >= 0x80 { return false }
@@ -2603,8 +2581,6 @@ impl u8 {
26032581
/// # Examples
26042582
///
26052583
/// ```
2606-
/// #![feature(ascii_methods_on_intrinsics)]
2607-
///
26082584
/// let uppercase_a = b'A';
26092585
/// let uppercase_g = b'G';
26102586
/// let a = b'a';
@@ -2625,7 +2601,7 @@ impl u8 {
26252601
/// assert!(!lf.is_ascii_hexdigit());
26262602
/// assert!(!esc.is_ascii_hexdigit());
26272603
/// ```
2628-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2604+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
26292605
#[inline]
26302606
pub fn is_ascii_hexdigit(&self) -> bool {
26312607
if *self >= 0x80 { return false }
@@ -2645,8 +2621,6 @@ impl u8 {
26452621
/// # Examples
26462622
///
26472623
/// ```
2648-
/// #![feature(ascii_methods_on_intrinsics)]
2649-
///
26502624
/// let uppercase_a = b'A';
26512625
/// let uppercase_g = b'G';
26522626
/// let a = b'a';
@@ -2667,7 +2641,7 @@ impl u8 {
26672641
/// assert!(!lf.is_ascii_punctuation());
26682642
/// assert!(!esc.is_ascii_punctuation());
26692643
/// ```
2670-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2644+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
26712645
#[inline]
26722646
pub fn is_ascii_punctuation(&self) -> bool {
26732647
if *self >= 0x80 { return false }
@@ -2683,8 +2657,6 @@ impl u8 {
26832657
/// # Examples
26842658
///
26852659
/// ```
2686-
/// #![feature(ascii_methods_on_intrinsics)]
2687-
///
26882660
/// let uppercase_a = b'A';
26892661
/// let uppercase_g = b'G';
26902662
/// let a = b'a';
@@ -2705,7 +2677,7 @@ impl u8 {
27052677
/// assert!(!lf.is_ascii_graphic());
27062678
/// assert!(!esc.is_ascii_graphic());
27072679
/// ```
2708-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2680+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
27092681
#[inline]
27102682
pub fn is_ascii_graphic(&self) -> bool {
27112683
if *self >= 0x80 { return false; }
@@ -2738,8 +2710,6 @@ impl u8 {
27382710
/// # Examples
27392711
///
27402712
/// ```
2741-
/// #![feature(ascii_methods_on_intrinsics)]
2742-
///
27432713
/// let uppercase_a = b'A';
27442714
/// let uppercase_g = b'G';
27452715
/// let a = b'a';
@@ -2760,7 +2730,7 @@ impl u8 {
27602730
/// assert!(lf.is_ascii_whitespace());
27612731
/// assert!(!esc.is_ascii_whitespace());
27622732
/// ```
2763-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2733+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
27642734
#[inline]
27652735
pub fn is_ascii_whitespace(&self) -> bool {
27662736
if *self >= 0x80 { return false; }
@@ -2778,8 +2748,6 @@ impl u8 {
27782748
/// # Examples
27792749
///
27802750
/// ```
2781-
/// #![feature(ascii_methods_on_intrinsics)]
2782-
///
27832751
/// let uppercase_a = b'A';
27842752
/// let uppercase_g = b'G';
27852753
/// let a = b'a';
@@ -2800,7 +2768,7 @@ impl u8 {
28002768
/// assert!(lf.is_ascii_control());
28012769
/// assert!(esc.is_ascii_control());
28022770
/// ```
2803-
#[unstable(feature = "ascii_methods_on_intrinsics", issue = "0")]
2771+
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
28042772
#[inline]
28052773
pub fn is_ascii_control(&self) -> bool {
28062774
if *self >= 0x80 { return false; }

0 commit comments

Comments
 (0)