Consider introducing debug messages in the compiler that are guarded by a flag #2242
Labels
bikeshedding
For bikeshedding trivialities
compiler
General compiler. Should eventually become more specific as the issue is triaged
enhancement
New feature or request
Inspired by Clang/LLVM, it would be nice to have messages in the compiler that are guarded by a flag that tells us what the compiler is doing at any given point. These could be per compiler stage or optimization pass. The way this works in LLVM is something like:
LLVM_DEBUG(dbg() << "Starting some complex step");
LLVM_DEBUG
is just a C++ macro anddbg()
is just likeprintln
.These message are hidden unless explicitly asked for in the command line by passing a flag
--debug
or--debug-only=<stage>
or something like that.It is also important to somehow remove these in production so they're not part of the final compiler binaries. I haven't look into how to do any of that in Rust yet.
As the compiler becomes more complex and the codebase grows larger, we're going to have to debug many complex issues (like #2240) and it would be nice to be able to pass a
--debug/--debug-only
flag to quickly figure out what stage is problematic before needing an actual debugger.The text was updated successfully, but these errors were encountered: