Closed
Description
I just found myself writing
.map(|line| if double_ice { dbg!(&line); (line, ICEKind::DoubleIce) } else { dbg!(&line); (line, ICEKind::Ice(interestingness)) });
only to discover that the dbg
macro in fact only prints the source line and not the column of the macro start or something like that 😅
[src/main.rs:1987] &line = "' left: Align(2 bytes)' ' right: Align(4 bytes)' assertion `left == right` failed: alignment mismatch between ABI and layout in TyAndLayout {"
[src/main.rs:1987] &line = "' left: Align(2 bytes)' ' right: Align(4 bytes)' assertion `left == right` failed: alignment mismatch between ABI and layout in TyAndLayout {"
[src/main.rs:1987] &line = "' left: Align(2 bytes)' ' right: Align(4 bytes)' assertion `left == right` failed: alignment mismatch between ABI and layout in TyAndLayout {"
[src/main.rs:1987] &line = "' left: Align(2 bytes)' ' right: Align(4 bytes)' assertion `left == right` failed: alignment mismatch between ABI and layout in TyAndLayout {"
[src/main.rs:1987] &line = "' left: Align(2 bytes)' ' right: Align(4 bytes)' assertion `left == right` failed: alignment mismatch between ABI and layout in TyAndLayout {"
Is it possible to add the column as well?
Activity
darklyspaced commentedon Aug 17, 2023
@rustbot claim
Urgau commentedon Aug 17, 2023
This section from the RFC is quite relevant, Excluding the column number:
darklyspaced commentedon Aug 18, 2023
while I agree with the fact that often there is only one debug statement a line, i think that there is one major benefit that the rfc overlooked: users can directly jump to the pertinent debug statement through one unified method regardless of what
<expr>
are used in the statement itself and if multiple share a single line. searching visually is always slower than a hard, concrete jump.additionally, the rfc failed to acknowledge the case above as being an ambiguous situation when using solely line numbers. all this combined with the fact that
means that it seems like a pretty sensible addition to the macro.
dbg!()
#114962Auto merge of rust-lang#114962 - darklyspaced:debug, r=est31
Auto merge of rust-lang#114962 - darklyspaced:debug, r=est31