]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/path.rs
Rollup merge of #104252 - faern:stabilize-const_socketaddr, r=JohnTitor
[rust.git] / library / std / src / path.rs
index c3593264e520b3243f98c01cbf80f12e9fa0b44c..2f53cf83936910e1df1dc217f96a8884c6f53302 100644 (file)
@@ -2531,6 +2531,8 @@ pub fn extension(&self) -> Option<&OsStr> {
 
     /// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
     ///
+    /// If `path` is absolute, it replaces the current path.
+    ///
     /// See [`PathBuf::push`] for more details on what it means to adjoin a path.
     ///
     /// # Examples
@@ -2539,6 +2541,7 @@ pub fn extension(&self) -> Option<&OsStr> {
     /// use std::path::{Path, PathBuf};
     ///
     /// assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
+    /// assert_eq!(Path::new("/etc").join("/bin/sh"), PathBuf::from("/bin/sh"));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     #[must_use]