-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Add some tracing to core bootstrap logic #136091
Conversation
The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes. cc @BoxyUwU, @jieyouxu, @Kobzol This PR modifies If appropriate, please update |
Looks like helpful improvements, r=me with nit |
cea05f9
to
97efda6
Compare
Removed the extra comma |
Add some tracing to core bootstrap logic Follow-up to rust-lang#135391. ### Summary Add some initial tracing logging to bootstrap, focused on the core logic (in this PR). Also: - Adjusted tracing-tree style to not use indent lines (I found that more distracting than helpful). - Avoid glob-importing `tracing` items. - Improve the rustc-dev-guide docs on bootstrap tracing. ### Example output ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap ``` ![Example bootstrap tracing output](https://github.com/user-attachments/assets/0be39042-0822-44b6-9451-30427cfea156) r? bootstrap
Rollup of 5 pull requests Successful merges: - rust-lang#135807 (Implement phantom variance markers) - rust-lang#136091 (Add some tracing to core bootstrap logic) - rust-lang#136094 (Upgrade elsa to the newest version.) - rust-lang#136097 (rustc_ast: replace some len-checks + indexing with slice patterns etc.) - rust-lang#136101 (triagebot: set myself on vacation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - rust-lang#126604 (Uplift `clippy::double_neg` lint as `double_negations`) - rust-lang#135158 (Add `TooGeneric` variant to `LayoutError` and emit `Unknown`) - rust-lang#135635 (Move `std::io::pipe` code into its own file) - rust-lang#136072 (add two old crash tests) - rust-lang#136079 (compiler_fence: fix example) - rust-lang#136091 (Add some tracing to core bootstrap logic) - rust-lang#136097 (rustc_ast: replace some len-checks + indexing with slice patterns etc.) - rust-lang#136101 (triagebot: set myself on vacation) r? `@ghost` `@rustbot` modify labels: rollup
#[cfg(feature = "tracing")] | ||
debug!("parsing flags"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simplify this by creating a logging wrapper macro (tracing_debug
?) gated from tracing
feature, which doesn't do anything on #[cfg(not(feature = "tracing")])
and uses debug
macro on #[cfg(feature = "tracing")]
, so you don't need to add this conditional checks everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I forgor you could just forward via $($tokens:tt)*
. I'll send a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up: #136392
Rollup merge of rust-lang#136091 - jieyouxu:core-tracing, r=clubby789 Add some tracing to core bootstrap logic Follow-up to rust-lang#135391. ### Summary Add some initial tracing logging to bootstrap, focused on the core logic (in this PR). Also: - Adjusted tracing-tree style to not use indent lines (I found that more distracting than helpful). - Avoid glob-importing `tracing` items. - Improve the rustc-dev-guide docs on bootstrap tracing. ### Example output ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap ``` ![Example bootstrap tracing output](https://github.com/user-attachments/assets/0be39042-0822-44b6-9451-30427cfea156) r? bootstrap
@bors r- ('fixing' desync) |
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? `@onur-ozkan` (or reroll)
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? ``@onur-ozkan`` (or reroll)
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? ```@onur-ozkan``` (or reroll)
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? ````@onur-ozkan```` (or reroll)
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? `@onur-ozkan` (or reroll)
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? ``@onur-ozkan`` (or reroll)
Rollup merge of rust-lang#136392 - jieyouxu:wrap-tracing, r=onur-ozkan bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? ``@onur-ozkan`` (or reroll)
bootstrap: add wrapper macros for `feature = "tracing"`-gated `tracing` macros Follow-up to rust-lang/rust#136091 (comment). - Add wrapper macros for `error!`, `warn!`, `info!`, `debug!` and `trace!`, which `cfg(feature = "tracing")`-gates the underlying `tracing` macros. They expand to nothing if `"tracing"` feature is not enabled. - This is not done for `span!` or `event!` because they can return span guards, and you can't really wrap that. - This is also not possible for `tracing::instrument` attribute proc-macro unless you use another attribute proc-macro to wrap that. It's not *great*, because `tracing::instrument` and `tracing::{span,event}` can't be wrapped this way. Can test locally with: ```bash $ BOOTSTRAP_TRACING=bootstrap=TRACE ./x check src/bootstrap/ ``` r? ``@onur-ozkan`` (or reroll)
Follow-up to #135391.
Summary
Add some initial tracing logging to bootstrap, focused on the core logic (in this PR).
Also:
tracing
items.Example output
r? bootstrap