add diagnostic items

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:
Andrea Nall 2021-02-15 02:27:20 +00:00
parent b86674e7cc
commit 5ef202520f
5 changed files with 8 additions and 0 deletions

View File

@ -796,6 +796,7 @@
options,
or,
or_patterns,
os_string_type,
other,
out,
overlapping_marker_traits,
@ -824,6 +825,7 @@
pat2018,
pat2021,
path,
path_buf_type,
pattern_parentheses,
phantom_data,
pin,
@ -1084,6 +1086,7 @@
slice,
slice_alloc,
slice_patterns,
slice_to_vec_method,
slice_u8,
slice_u8_alloc,
slicing_syntax,
@ -1159,6 +1162,7 @@
then_with,
thread,
thread_local,
to_owned_trait,
tool_attributes,
tool_lints,
trace_macros,

View File

@ -32,6 +32,7 @@ fn borrow(&self) -> &B {
/// to `T`. The `ToOwned` trait generalizes `Clone` to construct owned data
/// from any borrow of a given type.
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "to_owned_trait")]
pub trait ToOwned {
/// The resulting type after obtaining ownership.
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -442,6 +442,7 @@ macro_rules! sort_by_key {
/// // Here, `s` and `x` can be modified independently.
/// ```
#[rustc_conversion_suggestion]
#[rustc_diagnostic_item = "slice_to_vec_method"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn to_vec(&self) -> Vec<T>

View File

@ -71,6 +71,7 @@
/// [`CStr`]: crate::ffi::CStr
/// [conversions]: super#conversions
#[derive(Clone)]
#[cfg_attr(not(test), rustc_diagnostic_item = "os_string_type")]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct OsString {
inner: Buf,

View File

@ -1066,6 +1066,7 @@ impl FusedIterator for Ancestors<'_> {}
///
/// Which method works best depends on what kind of situation you're in.
#[derive(Clone)]
#[cfg_attr(not(test), rustc_diagnostic_item = "path_buf_type")]
#[stable(feature = "rust1", since = "1.0.0")]
// FIXME:
// `PathBuf::as_mut_vec` current implementation relies