File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 119119#![ feature( const_bigint_helper_methods) ]  
120120#![ feature( const_black_box) ]  
121121#![ feature( const_cell_into_inner) ]  
122+ #![ feature( const_char_encode_utf16) ]  
123+ #![ feature( const_char_encode_utf8) ]  
122124#![ feature( const_eval_select) ]  
123125#![ feature( const_exact_div) ]  
124126#![ feature( const_float_classify) ]  
131133#![ feature( const_ipv4) ]  
132134#![ feature( const_ipv6) ]  
133135#![ feature( const_likely) ]  
134- #![ feature( const_maybe_uninit_as_mut_ptr ) ]  
136+ #![ feature( const_make_ascii ) ]  
135137#![ feature( const_maybe_uninit_assume_init) ]  
136138#![ feature( const_nonnull_new) ]  
137139#![ feature( const_num_midpoint) ]  
150152#![ feature( const_slice_from_raw_parts_mut) ]  
151153#![ feature( const_slice_from_ref) ]  
152154#![ feature( const_slice_split_at_mut) ]  
155+ #![ feature( const_str_as_mut) ]  
153156#![ feature( const_str_from_utf8_unchecked_mut) ]  
154157#![ feature( const_strict_overflow_ops) ]  
155158#![ feature( const_swap) ]  
Original file line number Diff line number Diff line change @@ -67,10 +67,15 @@ impl [u8] {
6767/// 
6868/// [`to_ascii_uppercase`]: #method.to_ascii_uppercase 
6969#[ stable( feature = "ascii_methods_on_intrinsics" ,  since = "1.23.0" ) ]  
70+     #[ rustc_const_unstable( feature = "const_make_ascii" ,  issue = "130698" ) ]  
7071    #[ inline]  
71-     pub  fn  make_ascii_uppercase ( & mut  self )  { 
72-         for  byte in  self  { 
72+     pub  const  fn  make_ascii_uppercase ( & mut  self )  { 
73+         // FIXME(const-hack): We would like to simply iterate using `for` loops but this isn't currently allowed in constant expressions. 
74+         let  mut  i = 0x0 ; 
75+         while  i < self . len ( )  { 
76+             let  byte = & mut  self [ i] ; 
7377            byte. make_ascii_uppercase ( ) ; 
78+             i += 0x1 ; 
7479        } 
7580    } 
7681
@@ -84,10 +89,15 @@ impl [u8] {
8489/// 
8590/// [`to_ascii_lowercase`]: #method.to_ascii_lowercase 
8691#[ stable( feature = "ascii_methods_on_intrinsics" ,  since = "1.23.0" ) ]  
92+     #[ rustc_const_unstable( feature = "const_make_ascii" ,  issue = "130698" ) ]  
8793    #[ inline]  
88-     pub  fn  make_ascii_lowercase ( & mut  self )  { 
89-         for  byte in  self  { 
94+     pub  const  fn  make_ascii_lowercase ( & mut  self )  { 
95+         // FIXME(const-hack): We would like to simply iterate using `for` loops but this isn't currently allowed in constant expressions. 
96+         let  mut  i = 0x0 ; 
97+         while  i < self . len ( )  { 
98+             let  byte = & mut  self [ i] ; 
9099            byte. make_ascii_lowercase ( ) ; 
100+             i += 0x1 ; 
91101        } 
92102    } 
93103
Original file line number Diff line number Diff line change @@ -2469,8 +2469,9 @@ impl str {
24692469/// assert_eq!("GRüßE, JüRGEN ❤", s); 
24702470/// ``` 
24712471#[ stable( feature = "ascii_methods_on_intrinsics" ,  since = "1.23.0" ) ]  
2472+     #[ rustc_const_unstable( feature = "const_make_ascii" ,  issue = "130698" ) ]  
24722473    #[ inline]  
2473-     pub  fn  make_ascii_uppercase ( & mut  self )  { 
2474+     pub  const   fn  make_ascii_uppercase ( & mut  self )  { 
24742475        // SAFETY: changing ASCII letters only does not invalidate UTF-8. 
24752476        let  me = unsafe  {  self . as_bytes_mut ( )  } ; 
24762477        me. make_ascii_uppercase ( ) 
@@ -2496,8 +2497,9 @@ impl str {
24962497/// assert_eq!("grÜße, jÜrgen ❤", s); 
24972498/// ``` 
24982499#[ stable( feature = "ascii_methods_on_intrinsics" ,  since = "1.23.0" ) ]  
2500+     #[ rustc_const_unstable( feature = "const_make_ascii" ,  issue = "130698" ) ]  
24992501    #[ inline]  
2500-     pub  fn  make_ascii_lowercase ( & mut  self )  { 
2502+     pub  const   fn  make_ascii_lowercase ( & mut  self )  { 
25012503        // SAFETY: changing ASCII letters only does not invalidate UTF-8. 
25022504        let  me = unsafe  {  self . as_bytes_mut ( )  } ; 
25032505        me. make_ascii_lowercase ( ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments