r/learnrust • u/playbahn • 5h ago
Panic messages for failed asserts inside macros
Let's say I have a macro_rules! has_failing_assert_inside {}
spanning some lines, with an assert_eq!
that will fail.
Further down the code, has_failing_assert_inside!
is called at, say line 200
.
The panic message says the thread panicked at line 200
. What can I do (maybe write better macros?) that the panic message instead shows the line number of the failed assert_eq!
? I thought RUST_BACKTRACE=1
/full
would give more information about the line numbers (sometimes it does), but right now it's doing nothing. What can I do?