-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Consider making RUSTC_LOG=warn the default (instead of just error). #76824
Comments
This might not as big of a problem as I thought, @m-ou-se suggested checking if |
warn! then seems not significantly better than just an eprintln - am I missing something there? |
Perhaps, but I would prefer using This is even more important with |
Since we use |
This has gotten worse with |
@oli-obk I assume you mean this? Lines 688 to 695 in d8d1d10
This is just the old equivalent of disabling IIUC, "max" means the limit of what What we want is the default level, which doesn't seem to be anything nowadays, with |
Talking to @hawkw, we're in agreement this is very wrong: rust/compiler/rustc_driver/src/lib.rs Lines 1255 to 1261 in 55111d6
Bailing out means the whole output infrastructure isn't registered, so e.g. |
This is not correct. |
The bail out was done on purpose out of perf concerns. We can certainly bench it and see, but I would prefer to keep it as is and use the appropriate error/warn diagnostics of rustc instead of tracing statements |
Do you know more details? There aren't that many non- So the perf impact should be minimal, while offering a valuable infrastructure for miscellanea that has no other way to interface with the user. For something like Or maybe the warnings could be returned by value but that's an easy to misuse API, unlike |
Hmm... maybe it was just a misunderstanding while we were fixing other perf regressions. I'll open a PR later today to test it out. |
rustc_driver: Enable the `WARN` log level by default This commit changes the `tracing_subscriber` initialization in `rustc_driver` so that the `WARN` verbosity level is enabled by default when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env variable is set, the filter string in the environment variable is honored, instead. Fixes rust-lang#76824 Closes rust-lang#89623 cc `@eddyb,` `@oli-obk`
rustc_driver: Enable the `WARN` log level by default This commit changes the `tracing_subscriber` initialization in `rustc_driver` so that the `WARN` verbosity level is enabled by default when the `RUSTC_LOG` env variable is empty. If the `RUSTC_LOG` env variable is set, the filter string in the environment variable is honored, instead. Fixes rust-lang#76824 Closes rust-lang#89623 cc ``@eddyb,`` ``@oli-obk``
We don't use
error!
/warn!
/info!
a lot, but they come in handy for "debuggingrustc
without adebug-assertions
build" situations, e.g. we useinfo!
to show the function being codegen'd (as it's low-overhead and really helpful for e.g. LLVM crashes).While
info!
makes sense for off-by-default debugging helpers like that,error!
/warn!
seem closer to user-facing diagnostics, where the main difference is them being usable outside of code which has access to aSession
(either due to running before theSession
is created, or just in dependencies that have access tolog
/tracing
but not anyrustc
-specific diagnostics APIs).However, one surprising aspect is only
error!
is enabled by default, whilewarn!
is not, meaning that, with the current defaults, one is forced to choose betweenerror!
(which would output the word "error" which sounds more dire than "warning") orwarn!
(which may never be seen by an user).My usecase for
warn!
is in the upcoming-Z self-profile
support for using hardware performance counters (which needs to be implemented in the separatemeasureme
project), e.g. thiswarn!
instructs the user to open an issue if they have an unrecognized (newer) CPU, but there's nothing preventing-Z self-profile
from working (if the newer CPUs aren't drastically different), so showing "error" seems quite inappropriate.Sadly, I don't think
log
env_logger
itself will change this behavior, so even if we changeRUSTC_LOG
's default,measureme
might still have to use the less-appropriateerror!
if it wants to account for being used in other projects.cc @Mark-Simulacrum @gdhuper @hawkw
The text was updated successfully, but these errors were encountered: