From ef24de24a82fe681581cc130f342363c47c0969a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:48 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_log/Cargo.toml | 8 +++++++- compiler/rustc_log/src/lib.rs | 15 ++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'compiler/rustc_log') diff --git a/compiler/rustc_log/Cargo.toml b/compiler/rustc_log/Cargo.toml index aa6e46cd8..6009a43e9 100644 --- a/compiler/rustc_log/Cargo.toml +++ b/compiler/rustc_log/Cargo.toml @@ -4,13 +4,19 @@ version = "0.0.0" edition = "2021" [dependencies] +# tidy-alphabetical-start tracing = "0.1.28" +tracing-core = "=0.1.30" # FIXME(Nilstrieb) tracing has a deadlock: https://github.com/tokio-rs/tracing/issues/2635 tracing-subscriber = { version = "0.3.3", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] } tracing-tree = "0.2.0" -tracing-core = "=0.1.30" # FIXME(Nilstrieb) tracing has a deadlock: https://github.com/tokio-rs/tracing/issues/2635 +# tidy-alphabetical-end [dev-dependencies] +# tidy-alphabetical-start rustc_span = { path = "../rustc_span" } +# tidy-alphabetical-end [features] +# tidy-alphabetical-start max_level_info = ['tracing/max_level_info'] +# tidy-alphabetical-end diff --git a/compiler/rustc_log/src/lib.rs b/compiler/rustc_log/src/lib.rs index e7b80c641..0c9ec5565 100644 --- a/compiler/rustc_log/src/lib.rs +++ b/compiler/rustc_log/src/lib.rs @@ -23,10 +23,10 @@ //! } //! ``` //! -//! Now `LOG=debug cargo run` will run your minimal main.rs and show +//! Now `LOG=debug cargo +nightly run` will run your minimal main.rs and show //! rustc's debug logging. In a workflow like this, one might also add //! `std::env::set_var("LOG", "debug")` to the top of main so that `cargo -//! run` by itself is sufficient to get logs. +//! +nightly run` by itself is sufficient to get logs. //! //! The reason rustc_log is a tiny separate crate, as opposed to exposing the //! same things in rustc_driver only, is to enable the above workflow. If you @@ -74,6 +74,11 @@ pub fn init_env_logger(env: &str) -> Result<(), Error> { Some(v) => &v != "0", }; + let verbose_thread_ids = match env::var_os(String::from(env) + "_THREAD_IDS") { + None => false, + Some(v) => &v == "1", + }; + let layer = tracing_tree::HierarchicalLayer::default() .with_writer(io::stderr) .with_indent_lines(true) @@ -81,9 +86,9 @@ pub fn init_env_logger(env: &str) -> Result<(), Error> { .with_targets(true) .with_verbose_exit(verbose_entry_exit) .with_verbose_entry(verbose_entry_exit) - .with_indent_amount(2); - #[cfg(all(parallel_compiler, debug_assertions))] - let layer = layer.with_thread_ids(true).with_thread_names(true); + .with_indent_amount(2) + .with_thread_ids(verbose_thread_ids) + .with_thread_names(verbose_thread_ids); let subscriber = tracing_subscriber::Registry::default().with(filter).with(layer); match env::var(format!("{env}_BACKTRACE")) { -- cgit v1.2.3