Skip to content

Commit 8ff78fe

Browse files
committed
Add an additional special case const list for v2
1 parent ae540c2 commit 8ff78fe

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/overflow.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const SPECIAL_CASE_MACROS: &[(&str, usize)] = &[
4343
("println!", 0),
4444
("panic!", 0),
4545
("unreachable!", 0),
46-
// From the `log` crate. trace! is added for v2 - see `special_cases` below
46+
// From the `log` crate.
4747
("debug!", 0),
4848
("error!", 0),
4949
("info!", 0),
@@ -60,6 +60,13 @@ const SPECIAL_CASE_MACROS: &[(&str, usize)] = &[
6060
("debug_assert_ne!", 2),
6161
];
6262

63+
/// Additional special case macros for version 2; these are separated to avoid breaking changes in
64+
/// version 1.
65+
const SPECIAL_CASE_MACROS_V2: &[(&str, usize)] = &[
66+
// From the `log` crate.
67+
("trace!", 0),
68+
];
69+
6370
const SPECIAL_CASE_ATTR: &[(&str, usize)] = &[
6471
// From the `failure` crate.
6572
("fail", 0),
@@ -198,7 +205,7 @@ impl<'a> OverflowableItem<'a> {
198205

199206
fn special_cases_v2(&self) -> &'static [(&'static str, usize)] {
200207
match self {
201-
OverflowableItem::MacroArg(..) => &[("trace!", 0)],
208+
OverflowableItem::MacroArg(..) => SPECIAL_CASE_MACROS_V2,
202209
_ => &[],
203210
}
204211
}

0 commit comments

Comments
 (0)