Skip to content

Commit 183afcd

Browse files
authored
Rollup merge of rust-lang#59528 - DevQps:improve-dbg-macro-docs, r=Centril
Improve the dbg! macro docs # Description As stated has been discussed in rust-lang#58383 the docs do not clearly state why it is useful to have the option to use `dbg!` in release builds as well. This PR should change that. closes rust-lang#58383
2 parents 11e1b3e + 8705de4 commit 183afcd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libstd/macros.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,14 @@ macro_rules! eprintln {
233233
/// to give up ownership, you can instead borrow with `dbg!(&expr)`
234234
/// for some expression `expr`.
235235
///
236+
/// The `dbg!` macro works exactly the same in release builds.
237+
/// This is useful when debugging issues that only occur in release
238+
/// builds or when debugging in release mode is significantly faster.
239+
///
236240
/// Note that the macro is intended as a debugging tool and therefore you
237241
/// should avoid having uses of it in version control for longer periods.
238242
/// Use cases involving debug output that should be added to version control
239-
/// may be better served by macros such as `debug!` from the `log` crate.
243+
/// are better served by macros such as [`debug!`][debug-log] from the [`log`][log] crate.
240244
///
241245
/// # Stability
242246
///
@@ -311,6 +315,8 @@ macro_rules! eprintln {
311315
/// file and line whenever it's reached.
312316
///
313317
/// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)
318+
/// [debug-log]: https://docs.rs/log/*/log/macro.debug.html
319+
/// [log]: https://docs.rs/log/
314320
#[macro_export]
315321
#[stable(feature = "dbg_macro", since = "1.32.0")]
316322
macro_rules! dbg {

0 commit comments

Comments
 (0)