@@ -276,7 +276,7 @@ impl<'a> Prefix<'a> {
276
276
/// ```
277
277
/// use std::path;
278
278
///
279
- /// assert!(path::is_separator('/'));
279
+ /// assert!(path::is_separator('/')); // '/' works for both Unix and Windows
280
280
/// assert!(!path::is_separator('❤'));
281
281
/// ```
282
282
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1499,9 +1499,9 @@ impl AsRef<OsStr> for PathBuf {
1499
1499
/// A slice of a path (akin to [`str`]).
1500
1500
///
1501
1501
/// This type supports a number of operations for inspecting a path, including
1502
- /// breaking the path into its components (separated by `/` or `\`, depending on
1503
- /// the platform ), extracting the file name, determining whether the path is
1504
- /// absolute, and so on.
1502
+ /// breaking the path into its components (separated by `/` on Unix and by either
1503
+ /// `/` or `\` on Windows ), extracting the file name, determining whether the path
1504
+ /// is absolute, and so on.
1505
1505
///
1506
1506
/// This is an *unsized* type, meaning that it must always be used behind a
1507
1507
/// pointer like `&` or [`Box`]. For an owned version of this type,
@@ -1520,10 +1520,11 @@ impl AsRef<OsStr> for PathBuf {
1520
1520
/// use std::path::Path;
1521
1521
/// use std::ffi::OsStr;
1522
1522
///
1523
- /// let path = Path::new("/tmp/foo/bar.txt");
1523
+ /// // Note: this example does work on Windows
1524
+ /// let path = Path::new("./foo/bar.txt");
1524
1525
///
1525
1526
/// let parent = path.parent();
1526
- /// assert_eq!(parent, Some(Path::new("/tmp /foo")));
1527
+ /// assert_eq!(parent, Some(Path::new(". /foo")));
1527
1528
///
1528
1529
/// let file_stem = path.file_stem();
1529
1530
/// assert_eq!(file_stem, Some(OsStr::new("bar")));
0 commit comments