about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src/lib.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-02-08 20:01:25 -0800
committerGitHub <noreply@github.com>2023-02-08 20:01:25 -0800
commit32bb73eedef784a3a4a3225805e0977014cd5c72 (patch)
treec606c24a7b6e337da12e23bde88b383ce582c178 /compiler/rustc_driver_impl/src/lib.rs
parent04f770839d66d6881af44e28de69589dd6f8133e (diff)
parentf95b553eb4b6a2a0bf45e48c0cc5e9f635ba1e0c (diff)
downloadrust-32bb73eedef784a3a4a3225805e0977014cd5c72.tar.gz
rust-32bb73eedef784a3a4a3225805e0977014cd5c72.zip
Rollup merge of #107761 - oli-obk:miri_🪵, r=TaKO8Ki
Replace a command line flag with an env var to allow tools to initialize the tracing loggers at their own discretion

fixes https://github.com/rust-lang/miri/issues/2778

this was introduced in https://github.com/rust-lang/rust/pull/104645, so this PR reverts the flag-part and uses an env var instead.
Diffstat (limited to 'compiler/rustc_driver_impl/src/lib.rs')
-rw-r--r--compiler/rustc_driver_impl/src/lib.rs16
1 files changed, 2 insertions, 14 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index a392d70f100..bdf2978cee2 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -229,10 +229,6 @@ fn run_compiler(
         registry: diagnostics_registry(),
     };
 
-    if !tracing::dispatcher::has_been_set() {
-        init_rustc_env_logger_with_backtrace_option(&config.opts.unstable_opts.log_backtrace);
-    }
-
     match make_input(config.opts.error_format, &matches.free) {
         Err(reported) => return Err(reported),
         Ok(Some(input)) => {
@@ -1251,16 +1247,7 @@ pub fn install_ice_hook() {
 /// This allows tools to enable rust logging without having to magically match rustc's
 /// tracing crate version.
 pub fn init_rustc_env_logger() {
-    init_rustc_env_logger_with_backtrace_option(&None);
-}
-
-/// This allows tools to enable rust logging without having to magically match rustc's
-/// tracing crate version. In contrast to `init_rustc_env_logger` it allows you to
-/// choose a target module you wish to show backtraces along with its logging.
-pub fn init_rustc_env_logger_with_backtrace_option(backtrace_target: &Option<String>) {
-    if let Err(error) = rustc_log::init_rustc_env_logger_with_backtrace_option(backtrace_target) {
-        early_error(ErrorOutputType::default(), &error.to_string());
-    }
+    init_env_logger("RUSTC_LOG");
 }
 
 /// This allows tools to enable rust logging without having to magically match rustc's
@@ -1324,6 +1311,7 @@ mod signal_handler {
 pub fn main() -> ! {
     let start_time = Instant::now();
     let start_rss = get_resident_set_size();
+    init_rustc_env_logger();
     signal_handler::install();
     let mut callbacks = TimePassesCallbacks::default();
     install_ice_hook();