diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 980213be7ea..6d3ec9d4c63 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -3173,6 +3173,14 @@ impl AsRef for Path { } } +#[stable(feature = "cow_path_as_ref_os_str", since = "CURRENT_RUSTC_VERSION")] +impl AsRef for Cow<'_, Path> { + #[inline] + fn as_ref(&self) -> &OsStr { + self.as_os_str() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Path { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c8a60b68da8..1c0339ab26a 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -941,7 +941,7 @@ impl<'test> TestCx<'test> { .arg("-L") .arg(aux_dir) .arg("-o") - .arg(out_dir.as_ref()) + .arg(out_dir) .arg("--deny") .arg("warnings") .arg(&self.testpaths.file)