-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tell cargo to track logging environment variables #82763
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
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
Previously, changing the value of `RUSTC_LOG` would not rebuild, and, because cargo caches output, show exactly the same logging as before. This was confusing. Emit `RUSTC_LOG` with other `depinfo` dependencies so cargo knows to rebuild when it's changed. Note that this only adds RUSTC_LOG to depinfo. Unfortunately, adding RUSTDOC_LOG only when running as rustdoc doesn't help because rustdoc doesn't emit depinfo at all. Unconditionally emitting RUSTDOC_LOG in the depinfo doesn't help because cargo ignores it for everything except rustc itself. I am not yet sure how to fix this; see rust-lang/cargo#8374 for more info.
Alternatively, could you just add a build script emitting Wait, no, you don't want to rebuild the compiler, just rerun it for any given project. Nevermind me. |
Right - I want this to work for arbitrary projects, not just projects I work on a lot. |
I don't think this is a good idea. For example, when debugging an ICE in a project with a large number of dependencies, it can be very useful to repeatedly rebuild the root crate while varying |
Oh good catch, I hadn't thought of that. Is there a way to tell cargo to rebuild only the outermost crate (or maybe just path dependencies)? If not I guess cargo would have to special case logging. |
|
Right, I know about both, but that doesn't help with being surprised that |
touch compiler/rustc_crate_of_interest/src/lib.rs ? |
Regarding putting env vars to depinfo in general, I'm not sure who should make this choice, but I suspect it would be better to leave this job to a higher level tool (like cargo). We already have functions for tracked access to env variables in proc macros ( |
I was debugging some incremental compilation issues the other day, and this change would have made doing do unecessarily difficult. Once I got to an incremental-related ICE, I was able to re-run the compiler with different |
Previously, changing the value of
RUSTC_LOG
would not rebuild, and,because cargo caches output, show exactly the same logging as before.
This was confusing. Emit
RUSTC_LOG
with otherdepinfo
dependenciesso cargo knows to rebuild when it's changed.
Note that this only adds RUSTC_LOG to depinfo. Unfortunately, adding
RUSTDOC_LOG only when running as rustdoc doesn't help because rustdoc
doesn't emit depinfo at all. Unconditionally emitting RUSTDOC_LOG in the
depinfo doesn't help because cargo ignores it for everything except
rustc itself. I am not yet sure how to fix this; see
rust-lang/cargo#8374 for more info.