You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section should talk about the various tips and tricks for debugging the compiler, as well as perhaps some amount of "debug log conventions". It doesn't necessarily have to be a super long section, but here are some of the things I can think of:
example: -Ztreat-err-as-bug, which causes errors to be reported as bugs. Useful when you are debugging an error that should not be happening because you can use RUST_BACKTRACE=1 then to get a backtrace of where the error was reported; also avoids dumping out more logs than you need.
example: -Zunpretty=hir-tree, which will dump out the HIR
example: -Zverbose, which dumps out extra
see -Zhelp for more
Conventions for logs ("loosely followed")
Use {:?} most of the time in debug logs
I tend to use debug!("foo(...)") at the start of a function foo and debug!("foo: ...") or logs within that function (- nikomatsakis)
Options to try and correlate node-ids and def-ids with the source
This section should talk about the various tips and tricks for debugging the compiler, as well as perhaps some amount of "debug log conventions". It doesn't necessarily have to be a super long section, but here are some of the things I can think of:
RUST_LOGandconfig.tomlfirst and foremost (overlaps with "How to build the compiler and run what you built" #8)-Zflags:-Ztreat-err-as-bug, which causes errors to be reported as bugs. Useful when you are debugging an error that should not be happening because you can useRUST_BACKTRACE=1then to get a backtrace of where the error was reported; also avoids dumping out more logs than you need.-Zunpretty=hir-tree, which will dump out the HIR-Zverbose, which dumps out extra-Zhelpfor more{:?}most of the time in debug logsdebug!("foo(...)")at the start of a functionfooanddebug!("foo: ...")or logs within that function (- nikomatsakis)--pretty expanded,identified-Zdump-mirand-Zdump-mir-graphviz