diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2018-12-16 14:08:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-16 14:08:25 +0100 |
| commit | c52a13dcdfb060d6e637ac3557cb8ce8a1600543 (patch) | |
| tree | 33da61f3563d51322f5402d0e3afb029f66c2eea /src/libcore | |
| parent | af3f9072f541fd9d8da32d981e260df91772fbf8 (diff) | |
| parent | 33a34b06ac8828ffddc91b822fdec9f862658600 (diff) | |
| download | rust-c52a13dcdfb060d6e637ac3557cb8ce8a1600543.tar.gz rust-c52a13dcdfb060d6e637ac3557cb8ce8a1600543.zip | |
Rollup merge of #56761 - estebank:path-display, r=zackmdavis
Suggest using `.display()` when trying to print a `Path` Fix #38997.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/fmt/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 0c5256b981e..8e0caa5ae33 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -609,10 +609,15 @@ pub trait Debug { /// println!("The origin is: {}", origin); /// ``` #[rustc_on_unimplemented( + on( + _Self="std::path::Path", + label="`{Self}` cannot be formatted with the default formatter; call `.display()` on it", + note="call `.display()` or `.to_string_lossy()` to safely print paths, \ + as they may contain non-Unicode data" + ), message="`{Self}` doesn't implement `{Display}`", label="`{Self}` cannot be formatted with the default formatter", - note="in format strings you may be able to use `{{:?}}` \ - (or {{:#?}} for pretty-print) instead", + note="in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead", )] #[doc(alias = "{}")] #[stable(feature = "rust1", since = "1.0.0")] |
