about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorClar Fon <them@lightdark.xyz>2019-01-22 17:51:33 -0500
committerClar Fon <them@lightdark.xyz>2019-01-22 17:52:03 -0500
commit6fb5b73cf4dcf69e72ae414e83c53fe5eb8f0ffe (patch)
tree8365616e9a426bcb92c2e61beba368911a565b5a /src/libstd
parent96909179d9ec80db286605876ce67659dd16fd4b (diff)
downloadrust-6fb5b73cf4dcf69e72ae414e83c53fe5eb8f0ffe.tar.gz
rust-6fb5b73cf4dcf69e72ae414e83c53fe5eb8f0ffe.zip
dbg!() without parameters.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/macros.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index b87257188df..cfb8336e540 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -305,10 +305,16 @@ macro_rules! eprintln {
 /// let _ = dbg!(a); // <-- `a` is moved again; error!
 /// ```
 ///
+/// You can also use `dbg!()` without a value to just print the
+/// file and line whenever it's reached.
+///
 /// [stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)
 #[macro_export]
 #[stable(feature = "dbg_macro", since = "1.32.0")]
 macro_rules! dbg {
+    () => {
+        eprintln!("[{}:{}]", file!(), line!());
+    };
     ($val:expr) => {
         // Use of `match` here is intentional because it affects the lifetimes
         // of temporaries - https://stackoverflow.com/a/48732525/1063961