diff --git a/src/libstd/path.rs b/src/libstd/path.rs index eb125a4737a1c..ff528903b757f 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -576,6 +576,13 @@ impl<'a> AsRef for Component<'a> { } } +#[stable(feature = "path_component_asref", since = "1.24.0")] +impl<'a> AsRef for Component<'a> { + fn as_ref(&self) -> &Path { + self.as_os_str().as_ref() + } +} + /// An iterator over the [`Component`]s of a [`Path`]. /// /// This `struct` is created by the [`components`] method on [`Path`].