Skip to content

Commit a98b22c

Browse files
committed
Add caveat to Path::display() about lossiness
1 parent 9d3deed commit a98b22c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library/std/src/path.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,9 @@ impl Path {
23212321
}
23222322

23232323
/// Returns an object that implements [`Display`] for safely printing paths
2324-
/// that may contain non-Unicode data.
2324+
/// that may contain non-Unicode data. This may perform lossy conversion,
2325+
/// depending on the platform. If you would like an implementation which
2326+
/// escapes the path please use [`Debug`] instead.
23252327
///
23262328
/// [`Display`]: fmt::Display
23272329
///
@@ -2555,7 +2557,9 @@ impl fmt::Debug for Path {
25552557
///
25562558
/// A [`Path`] might contain non-Unicode data. This `struct` implements the
25572559
/// [`Display`] trait in a way that mitigates that. It is created by the
2558-
/// [`display`](Path::display) method on [`Path`].
2560+
/// [`display`](Path::display) method on [`Path`]. This may perform lossy
2561+
/// conversion, depending on the platform. If you would like an implementation
2562+
/// which escapes the path please use [`Debug`] instead.
25592563
///
25602564
/// # Examples
25612565
///

0 commit comments

Comments
 (0)