about summary refs log tree commit diff
path: root/src/libstd/path.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-04-20 06:28:16 +0000
committerbors <bors@rust-lang.org>2017-04-20 06:28:16 +0000
commitfa6b50fc6282a2c64814b35b16464a22f4ae9265 (patch)
tree3c2914f8b96d35eed2b3cbe0a27bc7b89be4272e /src/libstd/path.rs
parent1bb1530239c801bb46b705eb2874ac4e5b213e54 (diff)
parent204243fcac7dfb646c37cab0138fc037dcb0bd53 (diff)
Auto merge of #41413 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #41214, #41369, #41377, #41378, #41390
- Failed merges:
Diffstat (limited to 'src/libstd/path.rs')
-rw-r--r--src/libstd/path.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 22889b5de4c..812b65b61e7 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1414,6 +1414,9 @@ impl ToOwned for Path {
     fn to_owned(&self) -> PathBuf {
         self.to_path_buf()
     }
+    fn clone_into(&self, target: &mut PathBuf) {
+        self.inner.clone_into(&mut target.inner);
+    }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -3859,4 +3862,13 @@ mod tests {
         assert_eq!(&*boxed, &*path_buf);
         assert_eq!(&*path_buf, path);
     }
+
+    #[test]
+    fn test_clone_into() {
+        let mut path_buf = PathBuf::from("supercalifragilisticexpialidocious");
+        let path = Path::new("short");
+        path.clone_into(&mut path_buf);
+        assert_eq!(path, path_buf);
+        assert!(path_buf.into_os_string().capacity() >= 15);
+    }
 }