Skip to content

Commit 04874be

Browse files
committed
Adjust diagnostic items for mpmc/mpsc Receiver and Sender
`MpscReceiver` aligns with `MpscSender`. The original name appears to not actually have been in use, for better or worse. Along the way, sprinkle the attribute onto `mpmc::Receiver` and `mpmc::Sender` too.
1 parent ec6f9a5 commit 04874be

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

library/std/src/sync/mpmc/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ pub fn sync_channel<T>(cap: usize) -> (Sender<T>, Receiver<T>) {
297297
/// assert_eq!(3, msg + msg2);
298298
/// ```
299299
#[unstable(feature = "mpmc_channel", issue = "126840")]
300+
#[cfg_attr(not(test), rustc_diagnostic_item = "MpmcSender")]
300301
pub struct Sender<T> {
301302
flavor: SenderFlavor<T>,
302303
}
@@ -722,6 +723,7 @@ impl<T> fmt::Debug for Sender<T> {
722723
/// rx_thread_2.join().unwrap();
723724
/// ```
724725
#[unstable(feature = "mpmc_channel", issue = "126840")]
726+
#[cfg_attr(not(test), rustc_diagnostic_item = "MpmcReceiver")]
725727
pub struct Receiver<T> {
726728
flavor: ReceiverFlavor<T>,
727729
}

library/std/src/sync/mpsc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ use crate::{error, fmt};
173173
/// println!("{}", recv.recv().unwrap()); // Received after 2 seconds
174174
/// ```
175175
#[stable(feature = "rust1", since = "1.0.0")]
176-
#[cfg_attr(not(test), rustc_diagnostic_item = "Receiver")]
176+
#[cfg_attr(not(test), rustc_diagnostic_item = "MpscReceiver")]
177177
pub struct Receiver<T> {
178178
inner: mpmc::Receiver<T>,
179179
}

src/tools/clippy/clippy_utils/src/sym.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ generate! {
9090
MAX,
9191
MIN,
9292
MaybeDef,
93+
MpmcReceiver,
94+
MpmcSender,
95+
MpscReceiver,
96+
MpscSender,
9397
MsrvStack,
9498
Octal,
9599
OpenOptions,
@@ -99,7 +103,6 @@ generate! {
99103
PathBuf,
100104
PathLookup,
101105
RangeBounds,
102-
Receiver,
103106
RefCellRef,
104107
RefCellRefMut,
105108
Regex,

src/tools/clippy/clippy_utils/src/ty/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ pub fn has_iter_method(cx: &LateContext<'_>, probably_ref_ty: Ty<'_>) -> Option<
192192
sym::HashMap,
193193
sym::PathBuf,
194194
sym::Path,
195-
sym::Receiver,
195+
sym::MpscReceiver,
196+
sym::MpmcReceiver,
196197
];
197198

198199
let ty_to_check = match probably_ref_ty.kind() {

0 commit comments

Comments
 (0)