We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9690917 commit 6fb5b73Copy full SHA for 6fb5b73
src/libstd/macros.rs
@@ -305,10 +305,16 @@ macro_rules! eprintln {
305
/// let _ = dbg!(a); // <-- `a` is moved again; error!
306
/// ```
307
///
308
+/// You can also use `dbg!()` without a value to just print the
309
+/// file and line whenever it's reached.
310
+///
311
/// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)
312
#[macro_export]
313
#[stable(feature = "dbg_macro", since = "1.32.0")]
314
macro_rules! dbg {
315
+ () => {
316
+ eprintln!("[{}:{}]", file!(), line!());
317
+ };
318
($val:expr) => {
319
// Use of `match` here is intentional because it affects the lifetimes
320
// of temporaries - https://stackoverflow.com/a/48732525/1063961
0 commit comments