diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 3ee4ce80bd5..b5e08752344 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -632,9 +632,11 @@ fn is_sep_byte(&self, b: u8) -> bool { /// ``` /// use std::path::Path; /// - /// let path = Path::new("/tmp/foo/bar.txt"); + /// let mut components = Path::new("/tmp/foo/bar.txt").components(); + /// components.next(); + /// components.next(); /// - /// println!("{:?}", path.components().as_path()); + /// assert_eq!(Path::new("foo/bar.txt"), components.as_path()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn as_path(&self) -> &'a Path {