add example of joining with a absolute path

This commit is contained in:
Valdemar Erk 2023-01-20 12:03:43 +01:00
parent ec3da87582
commit d8f8adfe3d

View File

@ -2541,6 +2541,7 @@ impl Path {
/// 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]