-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Debugging the compiler" #11
Comments
cc #78 |
I just noticed that there is a page on forge on this topic: https://forge.rust-lang.org/debugging.html So, as a start, moving that content into the rustc-guide and removing the page from forge would be easy enough! |
Hey @nikomatsakis A rust beginner here and first time contributor to rust project. Might need some help in making the PR, but definitely interested in putting the time and working on it. Can I work on it 🙂 |
@cg-cnu Definitely! Thanks! Let us know if you need help :) |
I just tried to debug the compiler using
I wish there was an easy way to just use |
Generally the intent is to be more specific than just |
|
We should really tell people to use IIRC |
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_LOG
andconfig.toml
first 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=1
then 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-Zhelp
for more{:?}
most of the time in debug logsdebug!("foo(...)")
at the start of a functionfoo
anddebug!("foo: ...")
or logs within that function (- nikomatsakis)--pretty expanded,identified
-Zdump-mir
and-Zdump-mir-graphviz
The text was updated successfully, but these errors were encountered: