Skip to content

Commit

Permalink
Rollup merge of rust-lang#82196 - Manishearth:display-caveat, r=m-ou-se
Browse files Browse the repository at this point in the history
Add caveat to Path::display() about lossiness

It's worth calling out that this API may do a lossy display.

r? ``@m-ou-se``
  • Loading branch information
Dylan-DPC authored Feb 17, 2021
2 parents 25835bc + a98b22c commit 116f2e5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,9 @@ impl Path {
}

/// Returns an object that implements [`Display`] for safely printing paths
/// that may contain non-Unicode data.
/// that may contain non-Unicode data. This may perform lossy conversion,
/// depending on the platform. If you would like an implementation which
/// escapes the path please use [`Debug`] instead.
///
/// [`Display`]: fmt::Display
///
Expand Down Expand Up @@ -2555,7 +2557,9 @@ impl fmt::Debug for Path {
///
/// A [`Path`] might contain non-Unicode data. This `struct` implements the
/// [`Display`] trait in a way that mitigates that. It is created by the
/// [`display`](Path::display) method on [`Path`].
/// [`display`](Path::display) method on [`Path`]. This may perform lossy
/// conversion, depending on the platform. If you would like an implementation
/// which escapes the path please use [`Debug`] instead.
///
/// # Examples
///
Expand Down

0 comments on commit 116f2e5

Please sign in to comment.