]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #40009 - clarcharr:box_to_buf, r=alexcrichton
authorbors <bors@rust-lang.org>
Wed, 15 Mar 2017 04:24:10 +0000 (04:24 +0000)
committerbors <bors@rust-lang.org>
Wed, 15 Mar 2017 04:24:10 +0000 (04:24 +0000)
Leftovers from #39594; From<Box> impls

These are a few more impls that follow the same reasoning as those from #39594.

What's included:
* `From<Box<str>> for String`
* `From<Box<[T]>> for Vec<T>`
* `From<Box<CStr>> for CString`
* `From<Box<OsStr>> for OsString`
* `From<Box<Path>> for PathBuf`
* `Into<Box<str>> for String`
* `Into<Box<[T]>> for Vec<T>`
* `Into<Box<CStr>> for CString`
* `Into<Box<OsStr>> for OsString`
* `Into<Box<Path>> for PathBuf`
* `<Box<CStr>>::into_c_string`
* `<Box<OsStr>>::into_os_string`
* `<Box<Path>>::into_path_buf`
* Tracking issue for latter three methods + three from previous PR.

Currently, the opposite direction isn't doable with `From` (only `Into`) because of the separation between `liballoc` and `libcollections`. I'm holding off on those for a later PR.

1  2 
src/libstd/ffi/c_str.rs
src/libstd/ffi/os_str.rs
src/libstd/sys/redox/os_str.rs
src/libstd/sys/unix/os_str.rs
src/libstd/sys/windows/os_str.rs
src/libstd/sys_common/wtf8.rs

Simple merge
index 41bdd9c51d458e1c9d85f34cfdd1f0cc1ec6386a,c9c207d8b8eb4fcaec1259ed61a5b10e1ce0506a..2765fd83ed554027cb213cb07f484540ca91f085
@@@ -205,14 -205,8 +205,14 @@@ impl OsString 
          self.inner.reserve_exact(additional)
      }
  
 +    /// Shrinks the capacity of the `OsString` to match its length.
 +    #[unstable(feature = "osstring_shrink_to_fit", issue = "40421")]
 +    pub fn shrink_to_fit(&mut self) {
 +        self.inner.shrink_to_fit()
 +    }
 +
      /// Converts this `OsString` into a boxed `OsStr`.
-     #[unstable(feature = "into_boxed_os_str", issue = "0")]
+     #[unstable(feature = "into_boxed_os_str", issue = "40380")]
      pub fn into_boxed_os_str(self) -> Box<OsStr> {
          unsafe { mem::transmute(self.inner.into_box()) }
      }
Simple merge
Simple merge
Simple merge
Simple merge