diff --git a/std/src/ffi/os_str.rs b/std/src/ffi/os_str.rs index 8e1147338b047..0f905803bb8b9 100644 --- a/std/src/ffi/os_str.rs +++ b/std/src/ffi/os_str.rs @@ -919,6 +919,7 @@ impl OsStr { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline] + #[cfg_attr(not(test), rustc_diagnostic_item = "os_str_to_os_string")] pub fn to_os_string(&self) -> OsString { OsString { inner: self.inner.to_owned() } } diff --git a/std/src/path.rs b/std/src/path.rs index 6d6aa92711ba4..2ba3a9cdca251 100644 --- a/std/src/path.rs +++ b/std/src/path.rs @@ -2265,6 +2265,7 @@ impl Path { #[must_use = "this returns the result of the operation, \ without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] + #[cfg_attr(not(test), rustc_diagnostic_item = "path_to_pathbuf")] pub fn to_path_buf(&self) -> PathBuf { PathBuf::from(self.inner.to_os_string()) }