File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -729,10 +729,20 @@ impl String {
729729/// Note that this will drop any excess capacity. 
730730#[ unstable( feature = "box_str" ,  
731731               reason = "recently added, matches RFC" ) ]  
732-     pub  fn  into_boxed_slice ( self )  -> Box < str >  { 
732+     pub  fn  into_boxed_str ( self )  -> Box < str >  { 
733733        let  slice = self . vec . into_boxed_slice ( ) ; 
734734        unsafe  {  mem:: transmute :: < Box < [ u8 ] > ,  Box < str > > ( slice)  } 
735735    } 
736+ 
737+     /// Converts the string into `Box<str>`. 
738+ /// 
739+ /// Note that this will drop any excess capacity. 
740+ #[ unstable( feature = "box_str" ,  
741+                reason = "recently added, matches RFC" ) ]  
742+     #[ deprecated( since = "1.4.0" ,  reason = "renamed to `into_boxed_str`" ) ]  
743+     pub  fn  into_boxed_slice ( self )  -> Box < str >  { 
744+         self . into_boxed_str ( ) 
745+     } 
736746} 
737747
738748impl  FromUtf8Error  { 
Original file line number Diff line number Diff line change @@ -1204,13 +1204,13 @@ fn test_into_string() {
12041204    // The only way to acquire a Box<str> in the first place is through a String, so just 
12051205    // test that we can round-trip between Box<str> and String. 
12061206    let  string = String :: from ( "Some text goes here" ) ; 
1207-     assert_eq ! ( string. clone( ) . into_boxed_slice ( ) . into_string( ) ,  string) ; 
1207+     assert_eq ! ( string. clone( ) . into_boxed_str ( ) . into_string( ) ,  string) ; 
12081208} 
12091209
12101210#[ test]  
12111211fn  test_box_slice_clone ( )  { 
12121212    let  data = String :: from ( "hello HELLO hello HELLO yes YES 5 中ä华!!!" ) ; 
1213-     let  data2 = data. clone ( ) . into_boxed_slice ( ) . clone ( ) . into_string ( ) ; 
1213+     let  data2 = data. clone ( ) . into_boxed_str ( ) . clone ( ) . into_string ( ) ; 
12141214
12151215    assert_eq ! ( data,  data2) ; 
12161216} 
Original file line number Diff line number Diff line change @@ -366,9 +366,9 @@ fn test_extend_ref() {
366366} 
367367
368368#[ test]  
369- fn  test_into_boxed_slice ( )  { 
369+ fn  test_into_boxed_str ( )  { 
370370    let  xs = String :: from ( "hello my name is bob" ) ; 
371-     let  ys = xs. into_boxed_slice ( ) ; 
371+     let  ys = xs. into_boxed_str ( ) ; 
372372    assert_eq ! ( & * ys,  "hello my name is bob" ) ; 
373373} 
374374
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments