about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-08-08 14:10:54 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-08-08 14:51:24 +1000
commit0239e464876c8785e8601712220f17d9c58bcba6 (patch)
tree90c1bef000597778206e9d3ee0bbd46a620fca88
parent347cd4e6cb8a189c12a89e89a3951a5b1043308c (diff)
downloadrust-0239e464876c8785e8601712220f17d9c58bcba6.tar.gz
rust-0239e464876c8785e8601712220f17d9c58bcba6.zip
Fix some bad formatting in `-Zmacro-stats` output.
I also double-checked that everything looks good on some real-world
crates.
-rw-r--r--compiler/rustc_interface/src/passes.rs2
-rw-r--r--tests/ui/stats/macro-stats.stderr10
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 8dec8069bc7..8bbd0e61492 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -371,7 +371,7 @@ fn print_macro_stats(ecx: &ExtCtxt<'_>) {
             // The name won't abut or overlap with the uses value, but it does
             // overlap with the empty part of the uses column. Shrink the width
             // of the uses column to account for the excess name length.
-            uses_w = uses_with_underscores.len() + 1
+            uses_w -= name.len() - name_w;
         };
 
         _ = writeln!(
diff --git a/tests/ui/stats/macro-stats.stderr b/tests/ui/stats/macro-stats.stderr
index 0ef9adc6dd4..75b90df6466 100644
--- a/tests/ui/stats/macro-stats.stderr
+++ b/tests/ui/stats/macro-stats.stderr
@@ -22,11 +22,11 @@ macro-stats trait_tys!                            1          2        2.0
 macro-stats n99!                                  2          2        1.0          4        2.0
 macro-stats none!                                 1          1        1.0          4        4.0
 macro-stats u32!                                  1          1        1.0          3        3.0
-macro-stats long_name_that_fits_on_one_line! 10         10        1.0          0        0.0
+macro-stats long_name_that_fits_on_one_line!     10         10        1.0          0        0.0
 macro-stats long_name_that_fits_on_one_line_____! 1          1        1.0          0        0.0
-macro-stats long_name_that_fits_on_one_line____! 1          1        1.0          0        0.0
-macro-stats long_name_that_fits_on_one_line___! 1          1        1.0          0        0.0
-macro-stats long_name_that_fits_on_one_line__! 1          1        1.0          0        0.0
-macro-stats long_name_that_fits_on_one_line_! 1          1        1.0          0        0.0
+macro-stats long_name_that_fits_on_one_line____!  1          1        1.0          0        0.0
+macro-stats long_name_that_fits_on_one_line___!   1          1        1.0          0        0.0
+macro-stats long_name_that_fits_on_one_line__!    1          1        1.0          0        0.0
+macro-stats long_name_that_fits_on_one_line_!     1          1        1.0          0        0.0
 macro-stats #[test]                               1          1        1.0          0        0.0
 macro-stats ===================================================================================