about summary refs log tree commit diff
path: root/src/libstd/path.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-11-10 17:30:50 +0000
committerbors <bors@rust-lang.org>2015-11-10 17:30:50 +0000
commitea422eb4de1720d7bcfdc0fd850dc2d048da52ed (patch)
treed74b085de3a55d243398d65b437b79f24f08f1e9 /src/libstd/path.rs
parent05b66b8a1c74fe1182e594b330a4f5ab502eacc4 (diff)
parent4b0503f10f19aea023337ad8e82116690a238628 (diff)
downloadrust-ea422eb4de1720d7bcfdc0fd850dc2d048da52ed.tar.gz
rust-ea422eb4de1720d7bcfdc0fd850dc2d048da52ed.zip
Auto merge of #29749 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #29420, #29688, #29708, #29715, #29729, #29731
- Failed merges: #29544
Diffstat (limited to 'src/libstd/path.rs')
-rw-r--r--src/libstd/path.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index b9a58a11764..6b5e16ae113 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1013,6 +1013,21 @@ impl PathBuf {
     /// * if `path` has a root but no prefix (e.g. `\windows`), it
     ///   replaces everything except for the prefix (if any) of `self`.
     /// * if `path` has a prefix but no root, it replaces `self`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::path::PathBuf;
+    ///
+    /// let mut path = PathBuf::new();
+    /// path.push("/tmp");
+    /// path.push("file.bk");
+    /// assert_eq!(path, PathBuf::from("/tmp/file.bk"));
+    ///
+    /// // Pushing an absolute path replaces the current path
+    /// path.push("/etc/passwd");
+    /// assert_eq!(path, PathBuf::from("/etc/passwd"));
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn push<P: AsRef<Path>>(&mut self, path: P) {
         self._push(path.as_ref())