From f8930b44a582d93f083b9da3f61f8f8b989999f2 Mon Sep 17 00:00:00 2001
From: Samuel Tardieu <sam@rfc1149.net>
Date: Wed, 12 Feb 2025 22:18:27 +0100
Subject: [PATCH] Add diagnostic item for `std::io::BufRead`

This will be used in Clippy to detect unbuffered calls to
`Read::bytes()`.
---
 compiler/rustc_span/src/symbol.rs | 1 +
 library/std/src/io/mod.rs         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index bb59b4c40bd..9734926810a 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -250,6 +250,7 @@ symbols! {
         Into,
         IntoFuture,
         IntoIterator,
+        IoBufRead,
         IoLines,
         IoRead,
         IoSeek,
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index 0ffad2c27a4..980ea1478e0 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -2249,6 +2249,7 @@ fn skip_until<R: BufRead + ?Sized>(r: &mut R, delim: u8) -> Result<usize> {
 /// }
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
+#[cfg_attr(not(test), rustc_diagnostic_item = "IoBufRead")]
 pub trait BufRead: Read {
     /// Returns the contents of the internal buffer, filling it with more data
     /// from the inner reader if it is empty.