From 29ce695cd4e148682b0d439cc47dd36edb494673 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Tue, 17 Jun 2025 19:37:29 +0200 Subject: Stop dbg! macro yapping about format modifiers --- library/std/src/macros.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'library/std/src') diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs index f008d42804c..25e2b7ea137 100644 --- a/library/std/src/macros.rs +++ b/library/std/src/macros.rs @@ -363,7 +363,14 @@ macro_rules! dbg { match $val { tmp => { $crate::eprintln!("[{}:{}:{}] {} = {:#?}", - $crate::file!(), $crate::line!(), $crate::column!(), $crate::stringify!($val), &tmp); + $crate::file!(), + $crate::line!(), + $crate::column!(), + $crate::stringify!($val), + // The `&T: Debug` check happens here (not in the format literal desugaring) + // to avoid format literal related messages and suggestions. + &&tmp as &dyn $crate::fmt::Debug, + ); tmp } } -- cgit 1.4.1-3-g733a5