From f8930b44a582d93f083b9da3f61f8f8b989999f2 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu 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 bb59b4c40bd7f..9734926810ab2 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 0ffad2c27a4d5..980ea1478e084 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -2249,6 +2249,7 @@ fn skip_until(r: &mut R, delim: u8) -> Result { /// } /// ``` #[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.