Skip to content

Commit d0ddeb5

Browse files
authored
Rollup merge of #145082 - nnethercote:macro-stats-fix-widths, r=petrochenkov
Fix some bad formatting in `-Zmacro-stats` output. r? `@petrochenkov`
2 parents 354ef54 + 0239e46 commit d0ddeb5

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

compiler/rustc_interface/src/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ fn print_macro_stats(ecx: &ExtCtxt<'_>) {
371371
// The name won't abut or overlap with the uses value, but it does
372372
// overlap with the empty part of the uses column. Shrink the width
373373
// of the uses column to account for the excess name length.
374-
uses_w = uses_with_underscores.len() + 1
374+
uses_w -= name.len() - name_w;
375375
};
376376

377377
_ = writeln!(

tests/ui/stats/macro-stats.rs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,32 @@ fn opt(x: Option<u32>) {
4949
}
5050
}
5151

52-
macro_rules! long_name_that_fits_on_a_single_line {
53-
() => {}
54-
}
55-
long_name_that_fits_on_a_single_line!();
52+
macro_rules! long_name_that_fits_on_one_line { () => {} }
53+
long_name_that_fits_on_one_line!();
54+
long_name_that_fits_on_one_line!();
55+
long_name_that_fits_on_one_line!();
56+
long_name_that_fits_on_one_line!();
57+
long_name_that_fits_on_one_line!();
58+
long_name_that_fits_on_one_line!();
59+
long_name_that_fits_on_one_line!();
60+
long_name_that_fits_on_one_line!();
61+
long_name_that_fits_on_one_line!();
62+
long_name_that_fits_on_one_line!();
63+
64+
macro_rules! long_name_that_fits_on_one_line_ { () => {} }
65+
long_name_that_fits_on_one_line_!();
66+
67+
macro_rules! long_name_that_fits_on_one_line__ { () => {} }
68+
long_name_that_fits_on_one_line__!();
69+
70+
macro_rules! long_name_that_fits_on_one_line___ { () => {} }
71+
long_name_that_fits_on_one_line___!();
72+
73+
macro_rules! long_name_that_fits_on_one_line____ { () => {} }
74+
long_name_that_fits_on_one_line____!();
75+
76+
macro_rules! long_name_that_fits_on_one_line_____ { () => {} }
77+
long_name_that_fits_on_one_line_____!();
5678

5779
macro_rules! long_name_that_doesnt_fit_on_one_line {
5880
($t:ty) => {

tests/ui/stats/macro-stats.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ macro-stats trait_tys! 1 2 2.0
2222
macro-stats n99! 2 2 1.0 4 2.0
2323
macro-stats none! 1 1 1.0 4 4.0
2424
macro-stats u32! 1 1 1.0 3 3.0
25-
macro-stats long_name_that_fits_on_a_single_line! 1 1 1.0 0 0.0
25+
macro-stats long_name_that_fits_on_one_line! 10 10 1.0 0 0.0
26+
macro-stats long_name_that_fits_on_one_line_____! 1 1 1.0 0 0.0
27+
macro-stats long_name_that_fits_on_one_line____! 1 1 1.0 0 0.0
28+
macro-stats long_name_that_fits_on_one_line___! 1 1 1.0 0 0.0
29+
macro-stats long_name_that_fits_on_one_line__! 1 1 1.0 0 0.0
30+
macro-stats long_name_that_fits_on_one_line_! 1 1 1.0 0 0.0
2631
macro-stats #[test] 1 1 1.0 0 0.0
2732
macro-stats ===================================================================================

0 commit comments

Comments
 (0)