rustc-dev-guide
rustc-dev-guide copied to clipboard
Add logging in rustc itself that links to the dev-guide
It would really cool if, among the myriad other logging in rustc, we could also have 'dev-guide logging'. The idea is that you could have RUSTC_LOG=[rustc_dev_guide]=info, which shows logging from all crates that has a rustc_dev_guide span. I'm imagining something like this:
$ RUSTC_LOG=[rustc_dev_guide]=info rustc x.rs
INFO rustc_query_system[rustc_dev_guide] See https://rustc-dev-guide.rust-lang.org/query.html for more information about queries
INFO rustc_metadata[rustc_dev_guide] See https://rustc-dev-guide.rust-lang.org/serialization.html for more information about serialization in rustc
cc @hawkw - do you know if it's currently possible to have a span without a target? I'd hate to have to specify all 50 rustc_* crates by hand.
cc @igaray - I think you said you had a partial prototype for this?
Why not just have links to the dev guide in the compiler docs? I'm not sure if I see how this would be useful.
@camelid that requires you to know ahead of time how to find the compiler docs, and which modules are relevant. This would let you say 'give me all the relevant info' at once.
That said, maybe it's not much better than just browsing through https://rustc-dev-guide.rust-lang.org/ :/
Why would someone think to run that command though? It seems much more likely they would just look through the dev-guide or the compiler docs.
I think it makes more sense to have a page in the dev-guide that has a table that shows each theoretical part of the compiler (parser, type-checker, optimizer), the location in the source code (e.g., rustc_mir::borrow_check), and the chapter in the dev-guide.
@igaray what do you think?