Skip to content

Commit

Permalink
Fix trace! args overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
samtay committed Dec 22, 2023
1 parent d739d93 commit 3aa61ee
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const SPECIAL_CASE_MACROS: &[(&str, usize)] = &[
("panic!", 0),
("unreachable!", 0),
// From the `log` crate.
("trace!", 0),
("debug!", 0),
("error!", 0),
("info!", 0),
Expand Down
4 changes: 4 additions & 0 deletions tests/source/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ fn special_case_macros() {
debug!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
debug!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);

trace!("{}", 1);
trace!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
trace!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);

error!("{}", 1);
error!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
error!("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);
Expand Down
35 changes: 35 additions & 0 deletions tests/target/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,41 @@ fn special_case_macros() {
26
);

trace!("{}", 1);
trace!(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
);
trace!(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26
);

error!("{}", 1);
error!(
"{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
Expand Down

0 comments on commit 3aa61ee

Please sign in to comment.