Skip to content

Commit daf8ed1

Browse files
authored
Rollup merge of rust-lang#142787 - samueltardieu:diag-items-for-clippy, r=Manishearth,Urgau
Add diagnostic items for Clippy Clippy still uses some paths to access items from the standard library. Adding the missing diagnostic items allows removing the last remaining paths. Closes rust-lang/rust-clippy#5393
2 parents cad36ed + 310b251 commit daf8ed1

File tree

6 files changed

+7
-0
lines changed

6 files changed

+7
-0
lines changed

core/src/char/methods.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ impl char {
395395
/// ```
396396
#[stable(feature = "rust1", since = "1.0.0")]
397397
#[rustc_const_stable(feature = "const_char_convert", since = "1.67.0")]
398+
#[rustc_diagnostic_item = "char_to_digit"]
398399
#[must_use = "this returns the result of the operation, \
399400
without modifying the original"]
400401
#[inline]

core/src/iter/range.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ unsafe_impl_trusted_step![AsciiChar char i8 i16 i32 i64 i128 isize u8 u16 u32 u6
2020
///
2121
/// The *successor* operation moves towards values that compare greater.
2222
/// The *predecessor* operation moves towards values that compare lesser.
23+
#[rustc_diagnostic_item = "range_step"]
2324
#[unstable(feature = "step_trait", issue = "42168")]
2425
pub trait Step: Clone + PartialOrd + Sized {
2526
/// Returns the bounds on the number of *successor* steps required to get from `start` to `end`

core/src/macros/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,7 @@ pub(crate) mod builtin {
11921192
/// ```
11931193
#[stable(feature = "rust1", since = "1.0.0")]
11941194
#[rustc_builtin_macro]
1195+
#[rustc_diagnostic_item = "macro_concat"]
11951196
#[macro_export]
11961197
macro_rules! concat {
11971198
($($e:expr),* $(,)?) => {{ /* compiler built-in */ }};

core/src/mem/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ pub fn min_align_of_val<T: ?Sized>(val: &T) -> usize {
481481
#[stable(feature = "rust1", since = "1.0.0")]
482482
#[rustc_promotable]
483483
#[rustc_const_stable(feature = "const_align_of", since = "1.24.0")]
484+
#[rustc_diagnostic_item = "mem_align_of"]
484485
pub const fn align_of<T>() -> usize {
485486
intrinsics::align_of::<T>()
486487
}

core/src/slice/raw.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a m
198198
/// Converts a reference to T into a slice of length 1 (without copying).
199199
#[stable(feature = "from_ref", since = "1.28.0")]
200200
#[rustc_const_stable(feature = "const_slice_from_ref_shared", since = "1.63.0")]
201+
#[rustc_diagnostic_item = "slice_from_ref"]
201202
#[must_use]
202203
pub const fn from_ref<T>(s: &T) -> &[T] {
203204
array::from_ref(s)

std/src/io/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct Custom {
219219
/// the recognized error kinds and fail in those cases.
220220
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
221221
#[stable(feature = "rust1", since = "1.0.0")]
222+
#[cfg_attr(not(test), rustc_diagnostic_item = "io_errorkind")]
222223
#[allow(deprecated)]
223224
#[non_exhaustive]
224225
pub enum ErrorKind {
@@ -562,6 +563,7 @@ impl Error {
562563
/// let eof_error = Error::from(ErrorKind::UnexpectedEof);
563564
/// ```
564565
#[stable(feature = "rust1", since = "1.0.0")]
566+
#[cfg_attr(not(test), rustc_diagnostic_item = "io_error_new")]
565567
#[inline(never)]
566568
pub fn new<E>(kind: ErrorKind, error: E) -> Error
567569
where

0 commit comments

Comments
 (0)