Skip to content

Commit 41af98d

Browse files
authored
Rollup merge of rust-lang#82128 - anall:feature/add_diagnostic_items, r=davidtwco
add diagnostic items for OsString/PathBuf/Owned as well as to_vec on slice This is adding diagnostic items to be used by rust-lang/rust-clippy#6730, but my understanding is the clippy-side change does need to be done over there since I am adding a new clippy feature. Add diagnostic items to the following types: OsString (os_string_type) PathBuf (path_buf_type) Owned (to_owned_trait) As well as the to_vec method on slice/[T]
2 parents 3ac170e + 68f2029 commit 41af98d

File tree

5 files changed

+7
-0
lines changed

5 files changed

+7
-0
lines changed

alloc/src/borrow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ where
3131
/// implementing the `Clone` trait. But `Clone` works only for going from `&T`
3232
/// to `T`. The `ToOwned` trait generalizes `Clone` to construct owned data
3333
/// from any borrow of a given type.
34+
#[cfg_attr(not(test), rustc_diagnostic_item = "ToOwned")]
3435
#[stable(feature = "rust1", since = "1.0.0")]
3536
pub trait ToOwned {
3637
/// The resulting type after obtaining ownership.

alloc/src/slice.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ mod hack {
222222
}
223223

224224
#[lang = "slice_alloc"]
225+
#[cfg_attr(not(test), rustc_diagnostic_item = "slice")]
225226
#[cfg(not(test))]
226227
impl<T> [T] {
227228
/// Sorts the slice.

alloc/src/string.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,7 @@ impl FromStr for String {
21752175
/// implementation for free.
21762176
///
21772177
/// [`Display`]: fmt::Display
2178+
#[cfg_attr(not(test), rustc_diagnostic_item = "ToString")]
21782179
#[stable(feature = "rust1", since = "1.0.0")]
21792180
pub trait ToString {
21802181
/// Converts the given value to a `String`.

std/src/ffi/os_str.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
7171
/// [`CStr`]: crate::ffi::CStr
7272
/// [conversions]: super#conversions
7373
#[derive(Clone)]
74+
#[cfg_attr(not(test), rustc_diagnostic_item = "OsString")]
7475
#[stable(feature = "rust1", since = "1.0.0")]
7576
pub struct OsString {
7677
inner: Buf,
@@ -93,6 +94,7 @@ impl crate::sealed::Sealed for OsString {}
9394
///
9495
/// [`&str`]: str
9596
/// [conversions]: super#conversions
97+
#[cfg_attr(not(test), rustc_diagnostic_item = "OsStr")]
9698
#[stable(feature = "rust1", since = "1.0.0")]
9799
// FIXME:
98100
// `OsStr::from_inner` current implementation relies

std/src/path.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ impl FusedIterator for Ancestors<'_> {}
10661066
///
10671067
/// Which method works best depends on what kind of situation you're in.
10681068
#[derive(Clone)]
1069+
#[cfg_attr(not(test), rustc_diagnostic_item = "PathBuf")]
10691070
#[stable(feature = "rust1", since = "1.0.0")]
10701071
// FIXME:
10711072
// `PathBuf::as_mut_vec` current implementation relies
@@ -1719,6 +1720,7 @@ impl AsRef<OsStr> for PathBuf {
17191720
/// let extension = path.extension();
17201721
/// assert_eq!(extension, Some(OsStr::new("txt")));
17211722
/// ```
1723+
#[cfg_attr(not(test), rustc_diagnostic_item = "Path")]
17221724
#[stable(feature = "rust1", since = "1.0.0")]
17231725
// FIXME:
17241726
// `Path::new` current implementation relies

0 commit comments

Comments
 (0)