Skip to content

Commit a0f5fa3

Browse files
committed
Add more diagnostic items for clippy
1 parent 1eee0fa commit a0f5fa3

29 files changed

+50
-0
lines changed

alloc/src/borrow.rs

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ pub trait ToOwned {
5555
/// ```
5656
#[stable(feature = "rust1", since = "1.0.0")]
5757
#[must_use = "cloning is often expensive and is not expected to have side effects"]
58+
#[cfg_attr(not(test), rustc_diagnostic_item = "to_owned_method")]
5859
fn to_owned(&self) -> Self::Owned;
5960

6061
/// Uses borrowed data to replace owned data, usually by cloning.

alloc/src/rc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,7 @@ impl<T, I: iter::TrustedLen<Item = T>> ToRcSlice<T> for I {
27012701
///
27022702
/// [`upgrade`]: Weak::upgrade
27032703
#[stable(feature = "rc_weak", since = "1.4.0")]
2704+
#[cfg_attr(not(test), rustc_diagnostic_item = "RcWeak")]
27042705
pub struct Weak<
27052706
T: ?Sized,
27062707
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,

alloc/src/string.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2435,6 +2435,7 @@ pub trait ToString {
24352435
/// ```
24362436
#[rustc_conversion_suggestion]
24372437
#[stable(feature = "rust1", since = "1.0.0")]
2438+
#[cfg_attr(not(test), rustc_diagnostic_item = "to_string_method")]
24382439
fn to_string(&self) -> String;
24392440
}
24402441

alloc/src/sync.rs

+1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ impl<T: ?Sized, A: Allocator> Arc<T, A> {
311311
///
312312
/// [`upgrade`]: Weak::upgrade
313313
#[stable(feature = "arc_weak", since = "1.4.0")]
314+
#[cfg_attr(not(test), rustc_diagnostic_item = "ArcWeak")]
314315
pub struct Weak<
315316
T: ?Sized,
316317
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,

core/src/array/iter.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::{
1313
/// A by-value [array] iterator.
1414
#[stable(feature = "array_value_iter", since = "1.51.0")]
1515
#[rustc_insignificant_dtor]
16+
#[rustc_diagnostic_item = "ArrayIntoIter"]
1617
pub struct IntoIter<T, const N: usize> {
1718
/// This is the array we are iterating over.
1819
///

core/src/cell.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,7 @@ impl Clone for BorrowRef<'_> {
14231423
/// See the [module-level documentation](self) for more.
14241424
#[stable(feature = "rust1", since = "1.0.0")]
14251425
#[must_not_suspend = "holding a Ref across suspend points can cause BorrowErrors"]
1426+
#[rustc_diagnostic_item = "RefCellRef"]
14261427
pub struct Ref<'b, T: ?Sized + 'b> {
14271428
// NB: we use a pointer instead of `&'b T` to avoid `noalias` violations, because a
14281429
// `Ref` argument doesn't hold immutability for its whole scope, only until it drops.
@@ -1804,6 +1805,7 @@ impl<'b> BorrowRefMut<'b> {
18041805
/// See the [module-level documentation](self) for more.
18051806
#[stable(feature = "rust1", since = "1.0.0")]
18061807
#[must_not_suspend = "holding a RefMut across suspend points can cause BorrowErrors"]
1808+
#[rustc_diagnostic_item = "RefCellRefMut"]
18071809
pub struct RefMut<'b, T: ?Sized + 'b> {
18081810
// NB: we use a pointer instead of `&'b mut T` to avoid `noalias` violations, because a
18091811
// `RefMut` argument doesn't hold exclusivity for its whole scope, only until it drops.

core/src/cmp.rs

+1
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
809809
/// ```
810810
#[must_use]
811811
#[stable(feature = "rust1", since = "1.0.0")]
812+
#[rustc_diagnostic_item = "ord_cmp_method"]
812813
fn cmp(&self, other: &Self) -> Ordering;
813814

814815
/// Compares and returns the maximum of two values.

core/src/convert/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ pub use num::FloatToInt;
100100
#[stable(feature = "convert_id", since = "1.33.0")]
101101
#[rustc_const_stable(feature = "const_identity", since = "1.33.0")]
102102
#[inline(always)]
103+
#[rustc_diagnostic_item = "convert_identity"]
103104
pub const fn identity<T>(x: T) -> T {
104105
x
105106
}
@@ -642,6 +643,7 @@ pub trait TryFrom<T>: Sized {
642643

643644
/// Performs the conversion.
644645
#[stable(feature = "try_from", since = "1.34.0")]
646+
#[rustc_diagnostic_item = "try_from_fn"]
645647
fn try_from(value: T) -> Result<Self, Self::Error>;
646648
}
647649

core/src/default.rs

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ pub trait Default: Sized {
130130
/// }
131131
/// ```
132132
#[stable(feature = "rust1", since = "1.0.0")]
133+
#[rustc_diagnostic_item = "default_fn"]
133134
fn default() -> Self;
134135
}
135136

core/src/fmt/builders.rs

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ impl fmt::Write for PadAdapter<'_, '_> {
8484
#[must_use = "must eventually call `finish()` on Debug builders"]
8585
#[allow(missing_debug_implementations)]
8686
#[stable(feature = "debug_builders", since = "1.2.0")]
87+
#[rustc_diagnostic_item = "DebugStruct"]
8788
pub struct DebugStruct<'a, 'b: 'a> {
8889
fmt: &'a mut fmt::Formatter<'b>,
8990
result: fmt::Result,

core/src/fmt/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ impl<W: Write + ?Sized> Write for &mut W {
239239
/// documentation of the methods defined on `Formatter` below.
240240
#[allow(missing_debug_implementations)]
241241
#[stable(feature = "rust1", since = "1.0.0")]
242+
#[rustc_diagnostic_item = "Formatter"]
242243
pub struct Formatter<'a> {
243244
flags: u32,
244245
fill: char,

core/src/intrinsics.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1509,12 +1509,14 @@ extern "rust-intrinsic" {
15091509
///
15101510
/// This intrinsic does not have a stable counterpart.
15111511
#[rustc_nounwind]
1512+
#[rustc_diagnostic_item = "intrinsics_unaligned_volatile_load"]
15121513
pub fn unaligned_volatile_load<T>(src: *const T) -> T;
15131514
/// Performs a volatile store to the `dst` pointer.
15141515
/// The pointer is not required to be aligned.
15151516
///
15161517
/// This intrinsic does not have a stable counterpart.
15171518
#[rustc_nounwind]
1519+
#[rustc_diagnostic_item = "intrinsics_unaligned_volatile_store"]
15181520
pub fn unaligned_volatile_store<T>(dst: *mut T, val: T);
15191521

15201522
/// Returns the square root of an `f32`
@@ -2666,6 +2668,7 @@ pub(crate) fn is_nonoverlapping<T>(src: *const T, dst: *const T, count: usize) -
26662668
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
26672669
#[inline(always)]
26682670
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
2671+
#[rustc_diagnostic_item = "ptr_copy_nonoverlapping"]
26692672
pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize) {
26702673
extern "rust-intrinsic" {
26712674
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
@@ -2761,6 +2764,7 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
27612764
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
27622765
#[inline(always)]
27632766
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
2767+
#[rustc_diagnostic_item = "ptr_copy"]
27642768
pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
27652769
extern "rust-intrinsic" {
27662770
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.63.0")]
@@ -2834,6 +2838,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
28342838
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]
28352839
#[inline(always)]
28362840
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
2841+
#[rustc_diagnostic_item = "ptr_write_bytes"]
28372842
pub const unsafe fn write_bytes<T>(dst: *mut T, val: u8, count: usize) {
28382843
extern "rust-intrinsic" {
28392844
#[rustc_const_unstable(feature = "const_ptr_write", issue = "86302")]

core/src/iter/adapters/peekable.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::ops::{ControlFlow, Try};
1212
#[derive(Clone, Debug)]
1313
#[must_use = "iterators are lazy and do nothing unless consumed"]
1414
#[stable(feature = "rust1", since = "1.0.0")]
15+
#[rustc_diagnostic_item = "IterPeekable"]
1516
pub struct Peekable<I: Iterator> {
1617
iter: I,
1718
/// Remember a peeked value, even if it was None.

core/src/iter/sources/empty.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub const fn empty<T>() -> Empty<T> {
2727
/// This `struct` is created by the [`empty()`] function. See its documentation for more.
2828
#[must_use = "iterators are lazy and do nothing unless consumed"]
2929
#[stable(feature = "iter_empty", since = "1.2.0")]
30+
#[rustc_diagnostic_item = "IterEmpty"]
3031
pub struct Empty<T>(marker::PhantomData<fn() -> T>);
3132

3233
#[stable(feature = "core_impl_debug", since = "1.9.0")]

core/src/iter/sources/once.rs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ pub fn once<T>(value: T) -> Once<T> {
6161
/// This `struct` is created by the [`once()`] function. See its documentation for more.
6262
#[derive(Clone, Debug)]
6363
#[stable(feature = "iter_once", since = "1.2.0")]
64+
#[rustc_diagnostic_item = "IterOnce"]
6465
pub struct Once<T> {
6566
inner: crate::option::IntoIter<T>,
6667
}

core/src/iter/traits/collect.rs

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ pub trait FromIterator<A>: Sized {
146146
/// assert_eq!(v, vec![5, 5, 5, 5, 5]);
147147
/// ```
148148
#[stable(feature = "rust1", since = "1.0.0")]
149+
#[rustc_diagnostic_item = "from_iter_fn"]
149150
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self;
150151
}
151152

core/src/mem/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ pub unsafe fn uninitialized<T>() -> T {
723723
#[inline]
724724
#[stable(feature = "rust1", since = "1.0.0")]
725725
#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
726+
#[rustc_diagnostic_item = "mem_swap"]
726727
pub const fn swap<T>(x: &mut T, y: &mut T) {
727728
// NOTE(eddyb) SPIR-V's Logical addressing model doesn't allow for arbitrary
728729
// reinterpretation of values as (chunkable) byte arrays, and the loop in the

core/src/ops/deref.rs

+1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ impl<T: ?Sized> Deref for &mut T {
180180
pub trait DerefMut: Deref {
181181
/// Mutably dereferences the value.
182182
#[stable(feature = "rust1", since = "1.0.0")]
183+
#[rustc_diagnostic_item = "deref_mut_method"]
183184
fn deref_mut(&mut self) -> &mut Self::Target;
184185
}
185186

core/src/ops/range.rs

+1
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ impl<T: Clone> Bound<&T> {
758758
/// `RangeBounds` is implemented by Rust's built-in range types, produced
759759
/// by range syntax like `..`, `a..`, `..b`, `..=c`, `d..e`, or `f..=g`.
760760
#[stable(feature = "collections_range", since = "1.28.0")]
761+
#[rustc_diagnostic_item = "RangeBounds"]
761762
pub trait RangeBounds<T: ?Sized> {
762763
/// Start index bound.
763764
///

core/src/ptr/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ mod mut_ptr;
494494
#[stable(feature = "drop_in_place", since = "1.8.0")]
495495
#[lang = "drop_in_place"]
496496
#[allow(unconditional_recursion)]
497+
#[rustc_diagnostic_item = "ptr_drop_in_place"]
497498
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
498499
// Code here does not matter - this is replaced by the
499500
// real drop glue by the compiler.
@@ -740,6 +741,7 @@ pub const fn from_mut<T: ?Sized>(r: &mut T) -> *mut T {
740741
#[stable(feature = "slice_from_raw_parts", since = "1.42.0")]
741742
#[rustc_const_stable(feature = "const_slice_from_raw_parts", since = "1.64.0")]
742743
#[rustc_allow_const_fn_unstable(ptr_metadata)]
744+
#[rustc_diagnostic_item = "ptr_slice_from_raw_parts"]
743745
pub const fn slice_from_raw_parts<T>(data: *const T, len: usize) -> *const [T] {
744746
from_raw_parts(data.cast(), len)
745747
}
@@ -772,6 +774,7 @@ pub const fn slice_from_raw_parts<T>(data: *const T, len: usize) -> *const [T] {
772774
#[inline]
773775
#[stable(feature = "slice_from_raw_parts", since = "1.42.0")]
774776
#[rustc_const_unstable(feature = "const_slice_from_raw_parts_mut", issue = "67456")]
777+
#[rustc_diagnostic_item = "ptr_slice_from_raw_parts_mut"]
775778
pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T] {
776779
from_raw_parts_mut(data.cast(), len)
777780
}
@@ -850,6 +853,7 @@ pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T] {
850853
#[inline]
851854
#[stable(feature = "rust1", since = "1.0.0")]
852855
#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
856+
#[rustc_diagnostic_item = "ptr_swap"]
853857
pub const unsafe fn swap<T>(x: *mut T, y: *mut T) {
854858
// Give ourselves some scratch space to work with.
855859
// We do not have to worry about drops: `MaybeUninit` does nothing when dropped.
@@ -911,6 +915,7 @@ pub const unsafe fn swap<T>(x: *mut T, y: *mut T) {
911915
#[inline]
912916
#[stable(feature = "swap_nonoverlapping", since = "1.27.0")]
913917
#[rustc_const_unstable(feature = "const_swap", issue = "83163")]
918+
#[rustc_diagnostic_item = "ptr_swap_nonoverlapping"]
914919
pub const unsafe fn swap_nonoverlapping<T>(x: *mut T, y: *mut T, count: usize) {
915920
#[allow(unused)]
916921
macro_rules! attempt_swap_as_chunks {
@@ -1022,6 +1027,7 @@ const unsafe fn swap_nonoverlapping_simple_untyped<T>(x: *mut T, y: *mut T, coun
10221027
#[inline]
10231028
#[stable(feature = "rust1", since = "1.0.0")]
10241029
#[rustc_const_unstable(feature = "const_replace", issue = "83164")]
1030+
#[rustc_diagnostic_item = "ptr_replace"]
10251031
pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
10261032
// SAFETY: the caller must guarantee that `dst` is valid to be
10271033
// cast to a mutable reference (valid for writes, aligned, initialized),
@@ -1147,6 +1153,7 @@ pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
11471153
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
11481154
#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)]
11491155
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
1156+
#[rustc_diagnostic_item = "ptr_read"]
11501157
pub const unsafe fn read<T>(src: *const T) -> T {
11511158
// It would be semantically correct to implement this via `copy_nonoverlapping`
11521159
// and `MaybeUninit`, as was done before PR #109035. Calling `assume_init`
@@ -1264,6 +1271,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
12641271
#[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")]
12651272
#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)]
12661273
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
1274+
#[rustc_diagnostic_item = "ptr_read_unaligned"]
12671275
pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
12681276
let mut tmp = MaybeUninit::<T>::uninit();
12691277
// SAFETY: the caller must guarantee that `src` is valid for reads.
@@ -1539,6 +1547,7 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
15391547
#[inline]
15401548
#[stable(feature = "volatile", since = "1.9.0")]
15411549
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
1550+
#[rustc_diagnostic_item = "ptr_read_volatile"]
15421551
pub unsafe fn read_volatile<T>(src: *const T) -> T {
15431552
// SAFETY: the caller must uphold the safety contract for `volatile_load`.
15441553
unsafe {
@@ -1865,6 +1874,7 @@ pub(crate) const unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usiz
18651874
#[stable(feature = "ptr_eq", since = "1.17.0")]
18661875
#[inline(always)]
18671876
#[must_use = "pointer comparison produces a value"]
1877+
#[rustc_diagnostic_item = "ptr_eq"]
18681878
pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
18691879
a == b
18701880
}

core/src/ptr/non_null.rs

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ use crate::slice::{self, SliceIndex};
6868
#[repr(transparent)]
6969
#[rustc_layout_scalar_valid_range_start(1)]
7070
#[rustc_nonnull_optimization_guaranteed]
71+
#[rustc_diagnostic_item = "NonNull"]
7172
pub struct NonNull<T: ?Sized> {
7273
pointer: *const T,
7374
}

core/src/slice/iter.rs

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impl<'a, T> IntoIterator for &'a mut [T] {
5959
/// [slices]: slice
6060
#[stable(feature = "rust1", since = "1.0.0")]
6161
#[must_use = "iterators are lazy and do nothing unless consumed"]
62+
#[rustc_diagnostic_item = "SliceIter"]
6263
pub struct Iter<'a, T: 'a> {
6364
/// The pointer to the next element to return, or the past-the-end location
6465
/// if the iterator is empty.

core/src/slice/raw.rs

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ use crate::ptr;
9090
#[stable(feature = "rust1", since = "1.0.0")]
9191
#[rustc_const_stable(feature = "const_slice_from_raw_parts", since = "1.64.0")]
9292
#[must_use]
93+
#[rustc_diagnostic_item = "slice_from_raw_parts"]
9394
pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
9495
// SAFETY: the caller must uphold the safety contract for `from_raw_parts`.
9596
unsafe {
@@ -136,6 +137,7 @@ pub const unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T]
136137
#[stable(feature = "rust1", since = "1.0.0")]
137138
#[rustc_const_unstable(feature = "const_slice_from_raw_parts_mut", issue = "67456")]
138139
#[must_use]
140+
#[rustc_diagnostic_item = "slice_from_raw_parts_mut"]
139141
pub const unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] {
140142
// SAFETY: the caller must uphold the safety contract for `from_raw_parts_mut`.
141143
unsafe {

core/src/str/traits.rs

+1
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ pub trait FromStr: Sized {
624624
/// assert_eq!(5, x);
625625
/// ```
626626
#[stable(feature = "rust1", since = "1.0.0")]
627+
#[rustc_diagnostic_item = "from_str_method"]
627628
fn from_str(s: &str) -> Result<Self, Self::Err>;
628629
}
629630

std/src/fs.rs

+3
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ pub struct DirEntry(fs_imp::DirEntry);
184184
/// ```
185185
#[derive(Clone, Debug)]
186186
#[stable(feature = "rust1", since = "1.0.0")]
187+
#[cfg_attr(not(test), rustc_diagnostic_item = "FsOpenOptions")]
187188
pub struct OpenOptions(fs_imp::OpenOptions);
188189

189190
/// Representation of the various timestamps on a file.
@@ -201,6 +202,7 @@ pub struct FileTimes(fs_imp::FileTimes);
201202
/// [`PermissionsExt`]: crate::os::unix::fs::PermissionsExt
202203
#[derive(Clone, PartialEq, Eq, Debug)]
203204
#[stable(feature = "rust1", since = "1.0.0")]
205+
#[cfg_attr(not(test), rustc_diagnostic_item = "FsPermissions")]
204206
pub struct Permissions(fs_imp::FilePermissions);
205207

206208
/// A structure representing a type of file with accessors for each file type.
@@ -2241,6 +2243,7 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
22412243
/// ```
22422244
#[doc(alias = "mkdir")]
22432245
#[stable(feature = "rust1", since = "1.0.0")]
2246+
#[cfg_attr(not(test), rustc_diagnostic_item = "fs_create_dir")]
22442247
pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
22452248
DirBuilder::new().create(path.as_ref())
22462249
}

std/src/io/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,7 @@ pub trait Write {
18301830
/// }
18311831
/// ```
18321832
#[stable(feature = "rust1", since = "1.0.0")]
1833+
#[cfg_attr(not(test), rustc_diagnostic_item = "IoSeek")]
18331834
pub trait Seek {
18341835
/// Seek to an offset, in bytes, in a stream.
18351836
///
@@ -2893,6 +2894,7 @@ impl<B: BufRead> Iterator for Split<B> {
28932894
/// [`lines`]: BufRead::lines
28942895
#[stable(feature = "rust1", since = "1.0.0")]
28952896
#[derive(Debug)]
2897+
#[cfg_attr(not(test), rustc_diagnostic_item = "IoLines")]
28962898
pub struct Lines<B> {
28972899
buf: B,
28982900
}

std/src/io/stdio.rs

+2
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ static STDOUT: OnceLock<ReentrantMutex<RefCell<LineWriter<StdoutRaw>>>> = OnceLo
611611
/// ```
612612
#[must_use]
613613
#[stable(feature = "rust1", since = "1.0.0")]
614+
#[cfg_attr(not(test), rustc_diagnostic_item = "io_stdout")]
614615
pub fn stdout() -> Stdout {
615616
Stdout {
616617
inner: STDOUT
@@ -847,6 +848,7 @@ pub struct StderrLock<'a> {
847848
/// ```
848849
#[must_use]
849850
#[stable(feature = "rust1", since = "1.0.0")]
851+
#[cfg_attr(not(test), rustc_diagnostic_item = "io_stderr")]
850852
pub fn stderr() -> Stderr {
851853
// Note that unlike `stdout()` we don't use `at_exit` here to register a
852854
// destructor. Stderr is not buffered, so there's no need to run a

std/src/process.rs

+2
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ impl fmt::Debug for ChildStderr {
526526
/// list_dir.status().expect("process failed to execute");
527527
/// ```
528528
#[stable(feature = "process", since = "1.0.0")]
529+
#[cfg_attr(not(test), rustc_diagnostic_item = "Command")]
529530
pub struct Command {
530531
inner: imp::Command,
531532
}
@@ -2196,6 +2197,7 @@ impl Child {
21962197
/// process::exit(0x0100);
21972198
/// ```
21982199
#[stable(feature = "rust1", since = "1.0.0")]
2200+
#[cfg_attr(not(test), rustc_diagnostic_item = "process_exit")]
21992201
pub fn exit(code: i32) -> ! {
22002202
crate::rt::cleanup();
22012203
crate::sys::os::exit(code)

std/src/time.rs

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ pub use core::time::TryFromFloatSecsError;
153153
///
154154
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
155155
#[stable(feature = "time2", since = "1.8.0")]
156+
#[cfg_attr(not(test), rustc_diagnostic_item = "Instant")]
156157
pub struct Instant(time::Instant);
157158

158159
/// A measurement of the system clock, useful for talking to

0 commit comments

Comments
 (0)