1
Fork 0

Rollup merge of #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]
This commit is contained in:
Dylan DPC 2021-02-23 02:51:51 +01:00 committed by GitHub
commit b8d4354099
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 0 deletions

View file

@ -169,10 +169,14 @@ symbols! {
Option, Option,
Ord, Ord,
Ordering, Ordering,
OsStr,
OsString,
Output, Output,
Param, Param,
PartialEq, PartialEq,
PartialOrd, PartialOrd,
Path,
PathBuf,
Pending, Pending,
Pin, Pin,
Poll, Poll,
@ -198,6 +202,8 @@ symbols! {
StructuralPartialEq, StructuralPartialEq,
Sync, Sync,
Target, Target,
ToOwned,
ToString,
Try, Try,
Ty, Ty,
TyCtxt, TyCtxt,

View file

@ -31,6 +31,7 @@ where
/// implementing the `Clone` trait. But `Clone` works only for going from `&T` /// implementing the `Clone` trait. But `Clone` works only for going from `&T`
/// to `T`. The `ToOwned` trait generalizes `Clone` to construct owned data /// to `T`. The `ToOwned` trait generalizes `Clone` to construct owned data
/// from any borrow of a given type. /// from any borrow of a given type.
#[cfg_attr(not(test), rustc_diagnostic_item = "ToOwned")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait ToOwned { pub trait ToOwned {
/// The resulting type after obtaining ownership. /// The resulting type after obtaining ownership.

View file

@ -222,6 +222,7 @@ mod hack {
} }
#[lang = "slice_alloc"] #[lang = "slice_alloc"]
#[cfg_attr(not(test), rustc_diagnostic_item = "slice")]
#[cfg(not(test))] #[cfg(not(test))]
impl<T> [T] { impl<T> [T] {
/// Sorts the slice. /// Sorts the slice.

View file

@ -2175,6 +2175,7 @@ impl FromStr for String {
/// implementation for free. /// implementation for free.
/// ///
/// [`Display`]: fmt::Display /// [`Display`]: fmt::Display
#[cfg_attr(not(test), rustc_diagnostic_item = "ToString")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub trait ToString { pub trait ToString {
/// Converts the given value to a `String`. /// Converts the given value to a `String`.

View file

@ -71,6 +71,7 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
/// [`CStr`]: crate::ffi::CStr /// [`CStr`]: crate::ffi::CStr
/// [conversions]: super#conversions /// [conversions]: super#conversions
#[derive(Clone)] #[derive(Clone)]
#[cfg_attr(not(test), rustc_diagnostic_item = "OsString")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct OsString { pub struct OsString {
inner: Buf, inner: Buf,
@ -93,6 +94,7 @@ impl crate::sealed::Sealed for OsString {}
/// ///
/// [`&str`]: str /// [`&str`]: str
/// [conversions]: super#conversions /// [conversions]: super#conversions
#[cfg_attr(not(test), rustc_diagnostic_item = "OsStr")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
// FIXME: // FIXME:
// `OsStr::from_inner` current implementation relies // `OsStr::from_inner` current implementation relies

View file

@ -1066,6 +1066,7 @@ impl FusedIterator for Ancestors<'_> {}
/// ///
/// Which method works best depends on what kind of situation you're in. /// Which method works best depends on what kind of situation you're in.
#[derive(Clone)] #[derive(Clone)]
#[cfg_attr(not(test), rustc_diagnostic_item = "PathBuf")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
// FIXME: // FIXME:
// `PathBuf::as_mut_vec` current implementation relies // `PathBuf::as_mut_vec` current implementation relies
@ -1719,6 +1720,7 @@ impl AsRef<OsStr> for PathBuf {
/// let extension = path.extension(); /// let extension = path.extension();
/// assert_eq!(extension, Some(OsStr::new("txt"))); /// assert_eq!(extension, Some(OsStr::new("txt")));
/// ``` /// ```
#[cfg_attr(not(test), rustc_diagnostic_item = "Path")]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
// FIXME: // FIXME:
// `Path::new` current implementation relies // `Path::new` current implementation relies