diff --git a/src/libstd/path.rs b/src/libstd/path.rs index ec96157547383..e9ecca6869d15 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1493,6 +1493,13 @@ impl fmt::Debug for PathBuf { } } +#[stable(feature = "display_path", since = "1.27.0")] +impl fmt::Display for PathBuf { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&Display { path: &**self }, formatter) + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl ops::Deref for PathBuf { type Target = Path; @@ -2480,6 +2487,13 @@ impl AsRef for Path { } } +#[stable(feature = "display_for_path", since = "1.27.0")] +impl fmt::Display for Path { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&Display { path: self }, formatter) + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Path { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {