Skip to content

Commit faf89a6

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 16ce41b + 67fcaaa commit faf89a6

File tree

6 files changed

+13
-0
lines changed

6 files changed

+13
-0
lines changed

compiler/rustc_span/src/symbol.rs

+6
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,14 @@ symbols! {
169169
Option,
170170
Ord,
171171
Ordering,
172+
OsStr,
173+
OsString,
172174
Output,
173175
Param,
174176
PartialEq,
175177
PartialOrd,
178+
Path,
179+
PathBuf,
176180
Pending,
177181
Pin,
178182
Poll,
@@ -198,6 +202,8 @@ symbols! {
198202
StructuralPartialEq,
199203
Sync,
200204
Target,
205+
ToOwned,
206+
ToString,
201207
Try,
202208
Ty,
203209
TyCtxt,

library/alloc/src/borrow.rs

+1
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.

library/alloc/src/slice.rs

+1
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.

library/alloc/src/string.rs

+1
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`.

library/std/src/ffi/os_str.rs

+2
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

library/std/src/path.rs

+2
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)