From ec7230fea2f4a96a1993c54bf2b17892d2e978b4 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 24 Jul 2020 20:42:00 +0200 Subject: [PATCH 1/7] Move from `log` to `tracing` --- Cargo.lock | 168 +++++++++++++++------ src/librustc_ast/Cargo.toml | 2 +- src/librustc_ast_lowering/Cargo.toml | 2 +- src/librustc_ast_passes/Cargo.toml | 2 +- src/librustc_ast_pretty/Cargo.toml | 2 +- src/librustc_builtin_macros/Cargo.toml | 2 +- src/librustc_codegen_llvm/Cargo.toml | 2 +- src/librustc_codegen_ssa/Cargo.toml | 2 +- src/librustc_data_structures/Cargo.toml | 2 +- src/librustc_driver/Cargo.toml | 4 +- src/librustc_driver/lib.rs | 6 +- src/librustc_errors/Cargo.toml | 2 +- src/librustc_expand/Cargo.toml | 2 +- src/librustc_hir/Cargo.toml | 2 +- src/librustc_incremental/Cargo.toml | 2 +- src/librustc_infer/Cargo.toml | 2 +- src/librustc_interface/Cargo.toml | 2 +- src/librustc_lint/Cargo.toml | 2 +- src/librustc_metadata/Cargo.toml | 2 +- src/librustc_middle/Cargo.toml | 2 +- src/librustc_mir/Cargo.toml | 2 +- src/librustc_mir/interpret/eval_context.rs | 3 +- src/librustc_mir_build/Cargo.toml | 2 +- src/librustc_parse/Cargo.toml | 2 +- src/librustc_passes/Cargo.toml | 2 +- src/librustc_privacy/Cargo.toml | 2 +- src/librustc_query_system/Cargo.toml | 2 +- src/librustc_resolve/Cargo.toml | 2 +- src/librustc_save_analysis/Cargo.toml | 2 +- src/librustc_session/Cargo.toml | 2 +- src/librustc_span/Cargo.toml | 2 +- src/librustc_symbol_mangling/Cargo.toml | 2 +- src/librustc_target/Cargo.toml | 2 +- src/librustc_trait_selection/Cargo.toml | 2 +- src/librustc_traits/Cargo.toml | 2 +- src/librustc_ty/Cargo.toml | 2 +- src/librustc_typeck/Cargo.toml | 2 +- src/tools/compiletest/Cargo.toml | 2 +- 38 files changed, 165 insertions(+), 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6f2468055a1..367bf2ff0d92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,7 +61,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7021ce4924a3f25f802b2cccd1af585e39ea1a363a1aa2e72afe54b67a3a7a7" dependencies = [ - "ansi_term", + "ansi_term 0.11.0", ] [[package]] @@ -79,6 +79,15 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi 0.3.8", +] + [[package]] name = "anyhow" version = "1.0.31" @@ -496,7 +505,7 @@ version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" dependencies = [ - "ansi_term", + "ansi_term 0.11.0", "atty", "bitflags", "strsim", @@ -616,12 +625,12 @@ dependencies = [ "glob", "lazy_static", "libc", - "log", "miow 0.3.3", "regex", "rustfix", "serde", "serde_json", + "tracing", "walkdir", "winapi 0.3.8", ] @@ -1741,6 +1750,15 @@ dependencies = [ "tendril", ] +[[package]] +name = "matchers" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +dependencies = [ + "regex-automata", +] + [[package]] name = "matches" version = "0.1.8" @@ -2314,7 +2332,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427" dependencies = [ - "ansi_term", + "ansi_term 0.11.0", "ctor", "difference", "output_vt100", @@ -2678,6 +2696,16 @@ dependencies = [ "thread_local", ] +[[package]] +name = "regex-automata" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +dependencies = [ + "byteorder", + "regex-syntax", +] + [[package]] name = "regex-syntax" version = "0.6.17" @@ -3228,7 +3256,6 @@ name = "rustc_ast" version = "0.0.0" dependencies = [ "bitflags", - "log", "rustc_data_structures", "rustc_index", "rustc_lexer", @@ -3237,13 +3264,13 @@ dependencies = [ "rustc_span", "scoped-tls", "smallvec 1.4.0", + "tracing", ] [[package]] name = "rustc_ast_lowering" version = "0.0.0" dependencies = [ - "log", "rustc_arena", "rustc_ast", "rustc_ast_pretty", @@ -3255,6 +3282,7 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3262,7 +3290,6 @@ name = "rustc_ast_passes" version = "0.0.0" dependencies = [ "itertools 0.8.0", - "log", "rustc_ast", "rustc_ast_pretty", "rustc_attr", @@ -3272,16 +3299,17 @@ dependencies = [ "rustc_parse", "rustc_session", "rustc_span", + "tracing", ] [[package]] name = "rustc_ast_pretty" version = "0.0.0" dependencies = [ - "log", "rustc_ast", "rustc_span", "rustc_target", + "tracing", ] [[package]] @@ -3304,7 +3332,6 @@ dependencies = [ name = "rustc_builtin_macros" version = "0.0.0" dependencies = [ - "log", "rustc_ast", "rustc_ast_pretty", "rustc_attr", @@ -3318,6 +3345,7 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3327,7 +3355,6 @@ dependencies = [ "bitflags", "flate2", "libc", - "log", "measureme", "rustc-demangle", "rustc_ast", @@ -3347,6 +3374,7 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3357,7 +3385,6 @@ dependencies = [ "cc", "jobserver", "libc", - "log", "memmap", "num_cpus", "pathdiff", @@ -3377,6 +3404,7 @@ dependencies = [ "rustc_symbol_mangling", "rustc_target", "tempfile", + "tracing", ] [[package]] @@ -3391,7 +3419,6 @@ dependencies = [ "jobserver", "lazy_static", "libc", - "log", "measureme", "once_cell", "parking_lot 0.10.2", @@ -3404,6 +3431,7 @@ dependencies = [ "smallvec 1.4.0", "stable_deref_trait", "stacker", + "tracing", "winapi 0.3.8", ] @@ -3411,10 +3439,8 @@ dependencies = [ name = "rustc_driver" version = "0.0.0" dependencies = [ - "env_logger 0.7.1", "lazy_static", "libc", - "log", "rustc_ast", "rustc_ast_pretty", "rustc_codegen_ssa", @@ -3436,6 +3462,8 @@ dependencies = [ "rustc_session", "rustc_span", "rustc_target", + "tracing", + "tracing-subscriber", "winapi 0.3.8", ] @@ -3449,12 +3477,12 @@ version = "0.0.0" dependencies = [ "annotate-snippets 0.8.0", "atty", - "log", "rustc_data_structures", "rustc_serialize", "rustc_span", "termcolor", "termize", + "tracing", "unicode-width", "winapi 0.3.8", ] @@ -3463,7 +3491,6 @@ dependencies = [ name = "rustc_expand" version = "0.0.0" dependencies = [ - "log", "rustc_ast", "rustc_ast_passes", "rustc_ast_pretty", @@ -3477,6 +3504,7 @@ dependencies = [ "rustc_session", "rustc_span", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3501,7 +3529,6 @@ name = "rustc_hir" version = "0.0.0" dependencies = [ "lazy_static", - "log", "rustc_ast", "rustc_data_structures", "rustc_index", @@ -3510,6 +3537,7 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3527,7 +3555,6 @@ dependencies = [ name = "rustc_incremental" version = "0.0.0" dependencies = [ - "log", "rand 0.7.3", "rustc_ast", "rustc_data_structures", @@ -3538,6 +3565,7 @@ dependencies = [ "rustc_serialize", "rustc_session", "rustc_span", + "tracing", ] [[package]] @@ -3552,7 +3580,6 @@ dependencies = [ name = "rustc_infer" version = "0.0.0" dependencies = [ - "log", "rustc_ast", "rustc_data_structures", "rustc_errors", @@ -3566,6 +3593,7 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3573,7 +3601,6 @@ name = "rustc_interface" version = "0.0.0" dependencies = [ "libc", - "log", "once_cell", "rustc-rayon", "rustc_ast", @@ -3609,6 +3636,7 @@ dependencies = [ "rustc_typeck", "smallvec 1.4.0", "tempfile", + "tracing", "winapi 0.3.8", ] @@ -3623,7 +3651,6 @@ dependencies = [ name = "rustc_lint" version = "0.0.0" dependencies = [ - "log", "rustc_ast", "rustc_ast_pretty", "rustc_attr", @@ -3637,6 +3664,7 @@ dependencies = [ "rustc_span", "rustc_target", "rustc_trait_selection", + "tracing", "unicode-security", ] @@ -3665,7 +3693,6 @@ version = "0.0.0" dependencies = [ "flate2", "libc", - "log", "memmap", "rustc_ast", "rustc_attr", @@ -3682,6 +3709,7 @@ dependencies = [ "rustc_target", "smallvec 1.4.0", "stable_deref_trait", + "tracing", "winapi 0.3.8", ] @@ -3692,7 +3720,6 @@ dependencies = [ "bitflags", "byteorder", "chalk-ir", - "log", "measureme", "polonius-engine", "rustc-rayon-core", @@ -3713,6 +3740,7 @@ dependencies = [ "rustc_target", "scoped-tls", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3721,7 +3749,6 @@ version = "0.0.0" dependencies = [ "either", "itertools 0.8.0", - "log", "log_settings", "polonius-engine", "rustc_apfloat", @@ -3742,13 +3769,13 @@ dependencies = [ "rustc_target", "rustc_trait_selection", "smallvec 1.4.0", + "tracing", ] [[package]] name = "rustc_mir_build" version = "0.0.0" dependencies = [ - "log", "rustc_apfloat", "rustc_arena", "rustc_ast", @@ -3765,6 +3792,7 @@ dependencies = [ "rustc_target", "rustc_trait_selection", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3772,7 +3800,6 @@ name = "rustc_parse" version = "0.0.0" dependencies = [ "bitflags", - "log", "rustc_ast", "rustc_ast_pretty", "rustc_data_structures", @@ -3781,6 +3808,7 @@ dependencies = [ "rustc_lexer", "rustc_session", "rustc_span", + "tracing", "unicode-normalization", ] @@ -3796,7 +3824,6 @@ dependencies = [ name = "rustc_passes" version = "0.0.0" dependencies = [ - "log", "rustc_ast", "rustc_attr", "rustc_data_structures", @@ -3808,6 +3835,7 @@ dependencies = [ "rustc_span", "rustc_target", "rustc_trait_selection", + "tracing", ] [[package]] @@ -3828,7 +3856,6 @@ dependencies = [ name = "rustc_privacy" version = "0.0.0" dependencies = [ - "log", "rustc_attr", "rustc_data_structures", "rustc_errors", @@ -3837,13 +3864,13 @@ dependencies = [ "rustc_session", "rustc_span", "rustc_typeck", + "tracing", ] [[package]] name = "rustc_query_system" version = "0.0.0" dependencies = [ - "log", "parking_lot 0.10.2", "rustc-rayon-core", "rustc_arena", @@ -3853,6 +3880,7 @@ dependencies = [ "rustc_serialize", "rustc_span", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -3860,7 +3888,6 @@ name = "rustc_resolve" version = "0.0.0" dependencies = [ "bitflags", - "log", "rustc_arena", "rustc_ast", "rustc_ast_lowering", @@ -3877,13 +3904,13 @@ dependencies = [ "rustc_session", "rustc_span", "smallvec 1.4.0", + "tracing", ] [[package]] name = "rustc_save_analysis" version = "0.0.0" dependencies = [ - "log", "rls-data", "rls-span", "rustc_ast", @@ -3896,6 +3923,7 @@ dependencies = [ "rustc_session", "rustc_span", "serde_json", + "tracing", ] [[package]] @@ -3912,7 +3940,6 @@ version = "0.0.0" dependencies = [ "bitflags", "getopts", - "log", "num_cpus", "rustc_ast", "rustc_data_structures", @@ -3922,6 +3949,7 @@ dependencies = [ "rustc_serialize", "rustc_span", "rustc_target", + "tracing", ] [[package]] @@ -3929,7 +3957,6 @@ name = "rustc_span" version = "0.0.0" dependencies = [ "cfg-if", - "log", "md-5", "rustc_arena", "rustc_data_structures", @@ -3938,6 +3965,7 @@ dependencies = [ "rustc_serialize", "scoped-tls", "sha-1", + "tracing", "unicode-width", ] @@ -3945,7 +3973,6 @@ dependencies = [ name = "rustc_symbol_mangling" version = "0.0.0" dependencies = [ - "log", "punycode", "rustc-demangle", "rustc_ast", @@ -3955,6 +3982,7 @@ dependencies = [ "rustc_session", "rustc_span", "rustc_target", + "tracing", ] [[package]] @@ -3962,12 +3990,12 @@ name = "rustc_target" version = "0.0.0" dependencies = [ "bitflags", - "log", "rustc_data_structures", "rustc_index", "rustc_macros", "rustc_serialize", "rustc_span", + "tracing", ] [[package]] @@ -3984,7 +4012,6 @@ checksum = "b725dadae9fabc488df69a287f5a99c5eaf5d10853842a8a3dfac52476f544ee" name = "rustc_trait_selection" version = "0.0.0" dependencies = [ - "log", "rustc_ast", "rustc_attr", "rustc_data_structures", @@ -3999,6 +4026,7 @@ dependencies = [ "rustc_span", "rustc_target", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -4007,7 +4035,6 @@ version = "0.0.0" dependencies = [ "chalk-ir", "chalk-solve", - "log", "rustc_ast", "rustc_data_structures", "rustc_hir", @@ -4017,13 +4044,13 @@ dependencies = [ "rustc_span", "rustc_trait_selection", "smallvec 1.4.0", + "tracing", ] [[package]] name = "rustc_ty" version = "0.0.0" dependencies = [ - "log", "rustc_data_structures", "rustc_errors", "rustc_hir", @@ -4033,13 +4060,13 @@ dependencies = [ "rustc_span", "rustc_target", "rustc_trait_selection", + "tracing", ] [[package]] name = "rustc_typeck" version = "0.0.0" dependencies = [ - "log", "rustc_arena", "rustc_ast", "rustc_attr", @@ -4055,6 +4082,7 @@ dependencies = [ "rustc_target", "rustc_trait_selection", "smallvec 1.4.0", + "tracing", ] [[package]] @@ -4284,6 +4312,15 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "sharded-slab" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +dependencies = [ + "lazy_static", +] + [[package]] name = "shell-escape" version = "0.1.4" @@ -4931,9 +4968,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.15" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" +checksum = "f0aae59226cf195d8e74d4b34beae1859257efb4e5fed3f147d2dc2c7d372178" dependencies = [ "cfg-if", "tracing-attributes", @@ -4942,9 +4979,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" dependencies = [ "proc-macro2 1.0.3", "quote 1.0.2", @@ -4953,13 +4990,54 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +checksum = "b2734b5a028fa697686f16c6d18c2c6a3c7e41513f9a213abb6754c4acb3c8d7" dependencies = [ "lazy_static", ] +[[package]] +name = "tracing-log" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7b33f8b2ef2ab0c3778c12646d9c42a24f7772bee4cdafc72199644a9f58fdc" +dependencies = [ + "ansi_term 0.12.1", + "chrono", + "lazy_static", + "matchers", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec 1.4.0", + "tracing-core", + "tracing-log", + "tracing-serde", +] + [[package]] name = "typenum" version = "1.12.0" diff --git a/src/librustc_ast/Cargo.toml b/src/librustc_ast/Cargo.toml index 6bd65fd5f96c..a36f49bd4146 100644 --- a/src/librustc_ast/Cargo.toml +++ b/src/librustc_ast/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_serialize = { path = "../librustc_serialize" } -log = "0.4" +log = { package = "tracing", version = "0.1" } scoped-tls = "1.0" rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_ast_lowering/Cargo.toml b/src/librustc_ast_lowering/Cargo.toml index d71eb4fcd5c2..51f34a1b78e9 100644 --- a/src/librustc_ast_lowering/Cargo.toml +++ b/src/librustc_ast_lowering/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_arena = { path = "../librustc_arena" } -log = { version = "0.4", features = ["release_max_level_info", "std"] } +log = { package = "tracing", version = "0.1" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_hir = { path = "../librustc_hir" } rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_ast_passes/Cargo.toml b/src/librustc_ast_passes/Cargo.toml index e4d1d79abb2d..c53089a4afc5 100644 --- a/src/librustc_ast_passes/Cargo.toml +++ b/src/librustc_ast_passes/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" [dependencies] itertools = "0.8" -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_attr = { path = "../librustc_attr" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_ast_pretty/Cargo.toml b/src/librustc_ast_pretty/Cargo.toml index 6c076d2c5b86..4035346d3544 100644 --- a/src/librustc_ast_pretty/Cargo.toml +++ b/src/librustc_ast_pretty/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" doctest = false [dependencies] -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_span = { path = "../librustc_span" } rustc_ast = { path = "../librustc_ast" } rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_builtin_macros/Cargo.toml b/src/librustc_builtin_macros/Cargo.toml index fdb6c359052d..c612781153e8 100644 --- a/src/librustc_builtin_macros/Cargo.toml +++ b/src/librustc_builtin_macros/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_parse_format = { path = "../librustc_parse_format" } -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_attr = { path = "../librustc_attr" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index bedefcc30ed8..ec4dfabdcc2f 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -15,7 +15,7 @@ bitflags = "1.0" flate2 = "1.0" libc = "0.2" measureme = "0.7.1" -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc-demangle = "0.1" rustc_attr = { path = "../librustc_attr" } diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index e100e0095c92..8fa0de37648f 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -14,7 +14,7 @@ bitflags = "1.2.1" cc = "1.0.1" num_cpus = "1.0" memmap = "0.7" -log = "0.4.5" +log = { package = "tracing", version = "0.1" } libc = "0.2.50" jobserver = "0.1.11" tempfile = "3.1" diff --git a/src/librustc_data_structures/Cargo.toml b/src/librustc_data_structures/Cargo.toml index 1c2fb90b2d8b..811d1e49626c 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] ena = "0.14" indexmap = "1" -log = "0.4" +log = { package = "tracing", version = "0.1" } jobserver_crate = { version = "0.1.13", package = "jobserver" } lazy_static = "1" once_cell = { version = "1", features = ["parking_lot"] } diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 75d659207665..69dd221ef969 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -12,8 +12,8 @@ crate-type = ["dylib"] [dependencies] lazy_static = "1.0" libc = "0.2" -log = "0.4" -env_logger = { version = "0.7", default-features = false } +log = { package = "tracing", version = "0.1.18", features = ["release_max_level_info"] } +tracing-subscriber = { version = "0.2.10", features = ["fmt", "env-filter"] } rustc_middle = { path = "../librustc_middle" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index ab4eac9440b4..6faffae305d1 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1226,7 +1226,11 @@ pub fn install_ice_hook() { /// This allows tools to enable rust logging without having to magically match rustc's /// log crate version pub fn init_rustc_env_logger() { - env_logger::init_from_env("RUSTC_LOG"); + let builder = tracing_subscriber::FmtSubscriber::builder(); + + let builder = builder.with_env_filter(tracing_subscriber::EnvFilter::from_env("RUSTC_LOG")); + + builder.init() } pub fn main() -> ! { diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 7f72161aff82..d0f04c3fe764 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" doctest = false [dependencies] -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_serialize = { path = "../librustc_serialize" } rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_expand/Cargo.toml b/src/librustc_expand/Cargo.toml index ef617acfe131..bdf039c36abf 100644 --- a/src/librustc_expand/Cargo.toml +++ b/src/librustc_expand/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] rustc_serialize = { path = "../librustc_serialize" } -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_span = { path = "../librustc_span" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_ast_passes = { path = "../librustc_ast_passes" } diff --git a/src/librustc_hir/Cargo.toml b/src/librustc_hir/Cargo.toml index 1b91d769c704..4a404e176e14 100644 --- a/src/librustc_hir/Cargo.toml +++ b/src/librustc_hir/Cargo.toml @@ -18,5 +18,5 @@ rustc_span = { path = "../librustc_span" } rustc_serialize = { path = "../librustc_serialize" } rustc_ast = { path = "../librustc_ast" } lazy_static = "1" -log = { version = "0.4", features = ["release_max_level_info", "std"] } +log = { package = "tracing", version = "0.1" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index 7b3030fa1d9c..60a87078d63c 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_graphviz = { path = "../librustc_graphviz" } -log = "0.4" +log = { package = "tracing", version = "0.1" } rand = "0.7" rustc_middle = { path = "../librustc_middle" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_infer/Cargo.toml b/src/librustc_infer/Cargo.toml index 06fc7ecf95f2..9d56fa223a9c 100644 --- a/src/librustc_infer/Cargo.toml +++ b/src/librustc_infer/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_graphviz = { path = "../librustc_graphviz" } -log = { version = "0.4", features = ["release_max_level_info", "std"] } +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index 112dc7037f58..5c7edc10dd5c 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] libc = "0.2" -log = "0.4" +log = { package = "tracing", version = "0.1" } rayon = { version = "0.3.0", package = "rustc-rayon" } smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index 58c15257326a..3ba1566023d2 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -9,7 +9,7 @@ name = "rustc_lint" path = "lib.rs" [dependencies] -log = "0.4" +log = { package = "tracing", version = "0.1" } unicode-security = "0.0.5" rustc_middle = { path = "../librustc_middle" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 7bbe7567d292..2c0e2aa39fd5 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] flate2 = "1.0" libc = "0.2" -log = "0.4" +log = { package = "tracing", version = "0.1" } memmap = "0.7" smallvec = { version = "1.0", features = ["union", "may_dangle"] } rustc_middle = { path = "../librustc_middle" } diff --git a/src/librustc_middle/Cargo.toml b/src/librustc_middle/Cargo.toml index 02d82c679338..678fcfe65394 100644 --- a/src/librustc_middle/Cargo.toml +++ b/src/librustc_middle/Cargo.toml @@ -13,7 +13,7 @@ doctest = false rustc_arena = { path = "../librustc_arena" } bitflags = "1.2.1" scoped-tls = "1.0" -log = { version = "0.4", features = ["release_max_level_info", "std"] } +log = { package = "tracing", version = "0.1" } rustc-rayon-core = "0.3.0" polonius-engine = "0.12.0" rustc_apfloat = { path = "../librustc_apfloat" } diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index aebce78e4018..f05c47e0ed62 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -13,7 +13,7 @@ doctest = false either = "1.5.0" rustc_graphviz = { path = "../librustc_graphviz" } itertools = "0.8" -log = "0.4" +log = { package = "tracing", version = "0.1" } log_settings = "0.1.1" polonius-engine = "0.12.0" rustc_middle = { path = "../librustc_middle" } diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 630b2890835d..879a8e644907 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -818,11 +818,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ) -> InterpResult<'tcx> { // FIXME: should we tell the user that there was a local which was never written to? if let LocalValue::Live(Operand::Indirect(MemPlace { ptr, .. })) = local { - trace!("deallocating local"); // All locals have a backing allocation, even if the allocation is empty // due to the local having ZST type. let ptr = ptr.assert_ptr(); - trace!("{:?}", self.memory.dump_alloc(ptr.alloc_id)); + trace!("deallocating local: {:?}", self.memory.dump_alloc(ptr.alloc_id)); self.memory.deallocate_local(ptr)?; }; Ok(()) diff --git a/src/librustc_mir_build/Cargo.toml b/src/librustc_mir_build/Cargo.toml index 401a5009e3cf..96059fa43e52 100644 --- a/src/librustc_mir_build/Cargo.toml +++ b/src/librustc_mir_build/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_arena = { path = "../librustc_arena" } -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc_apfloat = { path = "../librustc_apfloat" } rustc_attr = { path = "../librustc_attr" } diff --git a/src/librustc_parse/Cargo.toml b/src/librustc_parse/Cargo.toml index 7164c6788086..f214ec020cbe 100644 --- a/src/librustc_parse/Cargo.toml +++ b/src/librustc_parse/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] bitflags = "1.0" -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_feature = { path = "../librustc_feature" } diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index 69048cbf24a3..d9fa435e3ad6 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -9,7 +9,7 @@ name = "rustc_passes" path = "lib.rs" [dependencies] -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc_attr = { path = "../librustc_attr" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/librustc_privacy/Cargo.toml b/src/librustc_privacy/Cargo.toml index 6110d2ef7fc9..6f543e71b428 100644 --- a/src/librustc_privacy/Cargo.toml +++ b/src/librustc_privacy/Cargo.toml @@ -17,4 +17,4 @@ rustc_typeck = { path = "../librustc_typeck" } rustc_session = { path = "../librustc_session" } rustc_span = { path = "../librustc_span" } rustc_data_structures = { path = "../librustc_data_structures" } -log = "0.4" +log = { package = "tracing", version = "0.1" } diff --git a/src/librustc_query_system/Cargo.toml b/src/librustc_query_system/Cargo.toml index 73d50f84fe83..64af9c5f1a15 100644 --- a/src/librustc_query_system/Cargo.toml +++ b/src/librustc_query_system/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_arena = { path = "../librustc_arena" } -log = { version = "0.4", features = ["release_max_level_info", "std"] } +log = { package = "tracing", version = "0.1" } rustc-rayon-core = "0.3.0" rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } diff --git a/src/librustc_resolve/Cargo.toml b/src/librustc_resolve/Cargo.toml index 6f6104c3d693..1cb49132ead9 100644 --- a/src/librustc_resolve/Cargo.toml +++ b/src/librustc_resolve/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] bitflags = "1.2.1" -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_ast = { path = "../librustc_ast" } rustc_arena = { path = "../librustc_arena" } rustc_middle = { path = "../librustc_middle" } diff --git a/src/librustc_save_analysis/Cargo.toml b/src/librustc_save_analysis/Cargo.toml index 5948c88054de..7a5ae0ace3ae 100644 --- a/src/librustc_save_analysis/Cargo.toml +++ b/src/librustc_save_analysis/Cargo.toml @@ -9,7 +9,7 @@ name = "rustc_save_analysis" path = "lib.rs" [dependencies] -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc_ast = { path = "../librustc_ast" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } diff --git a/src/librustc_session/Cargo.toml b/src/librustc_session/Cargo.toml index abce7359c0ed..35c227df8500 100644 --- a/src/librustc_session/Cargo.toml +++ b/src/librustc_session/Cargo.toml @@ -11,7 +11,7 @@ path = "lib.rs" [dependencies] bitflags = "1.2.1" getopts = "0.2" -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_errors = { path = "../librustc_errors" } rustc_feature = { path = "../librustc_feature" } rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_span/Cargo.toml b/src/librustc_span/Cargo.toml index 2a7a77487252..2db417ce0e12 100644 --- a/src/librustc_span/Cargo.toml +++ b/src/librustc_span/Cargo.toml @@ -18,6 +18,6 @@ rustc_arena = { path = "../librustc_arena" } scoped-tls = "1.0" unicode-width = "0.1.4" cfg-if = "0.1.2" -log = "0.4" +log = { package = "tracing", version = "0.1" } sha-1 = "0.8" md-5 = "0.8" diff --git a/src/librustc_symbol_mangling/Cargo.toml b/src/librustc_symbol_mangling/Cargo.toml index d670ababe9f1..757d86bd95af 100644 --- a/src/librustc_symbol_mangling/Cargo.toml +++ b/src/librustc_symbol_mangling/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" doctest = false [dependencies] -log = "0.4" +log = { package = "tracing", version = "0.1" } punycode = "0.4.0" rustc-demangle = "0.1.16" diff --git a/src/librustc_target/Cargo.toml b/src/librustc_target/Cargo.toml index c73490e45132..21796e849856 100644 --- a/src/librustc_target/Cargo.toml +++ b/src/librustc_target/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" [dependencies] bitflags = "1.2.1" -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_macros = { path = "../librustc_macros" } rustc_serialize = { path = "../librustc_serialize" } diff --git a/src/librustc_trait_selection/Cargo.toml b/src/librustc_trait_selection/Cargo.toml index fd11a85a9c40..c43fe3f2c0c8 100644 --- a/src/librustc_trait_selection/Cargo.toml +++ b/src/librustc_trait_selection/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] rustc_parse_format = { path = "../librustc_parse_format" } -log = { version = "0.4", features = ["release_max_level_info", "std"] } +log = { package = "tracing", version = "0.1" } rustc_attr = { path = "../librustc_attr" } rustc_middle = { path = "../librustc_middle" } rustc_ast = { path = "../librustc_ast" } diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml index 079b9b10fd09..f8487982e3d4 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -9,7 +9,7 @@ name = "rustc_traits" path = "lib.rs" [dependencies] -log = { version = "0.4" } +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_hir = { path = "../librustc_hir" } diff --git a/src/librustc_ty/Cargo.toml b/src/librustc_ty/Cargo.toml index b6db75e44f97..6cdb35300027 100644 --- a/src/librustc_ty/Cargo.toml +++ b/src/librustc_ty/Cargo.toml @@ -9,7 +9,7 @@ name = "rustc_ty" path = "lib.rs" [dependencies] -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index 93b503c976be..963deda162d6 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] rustc_arena = { path = "../librustc_arena" } -log = "0.4" +log = { package = "tracing", version = "0.1" } rustc_middle = { path = "../librustc_middle" } rustc_attr = { path = "../librustc_attr" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 338a167de3fe..bd4c5949800f 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" diff = "0.1.10" env_logger = { version = "0.7", default-features = false } getopts = "0.2" -log = "0.4" +log = { package = "tracing", version = "0.1" } regex = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" From 64296ec698b1c92ce148b968c101c18e63002bb2 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 24 Jul 2020 21:35:14 +0200 Subject: [PATCH 2/7] Add tracing libs to list of permitted dependencies --- src/tools/tidy/src/deps.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index e340a0e3f248..55e17466a881 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -166,6 +166,9 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[ "termcolor", "termize", "thread_local", + "tracing", + "tracing-attributes", + "tracing-core", "typenum", "unicode-normalization", "unicode-script", From 208f973d1f8ed7442a64c7784e1b4f5910722eb5 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sat, 25 Jul 2020 15:50:51 +0200 Subject: [PATCH 3/7] Make rustdoc share the logger initialization routine with rustc. --- src/librustc_driver/lib.rs | 11 +++++++++-- src/librustdoc/lib.rs | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 6faffae305d1..177fb2c2ec69 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1224,11 +1224,18 @@ pub fn install_ice_hook() { } /// This allows tools to enable rust logging without having to magically match rustc's -/// log crate version +/// log crate version. pub fn init_rustc_env_logger() { + init_env_logger("RUSTC_LOG") +} + +/// This allows tools to enable rust logging without having to magically match rustc's +/// log crate version. In contrast to `init_rustc_env_logger` it allows you to choose an env var +/// other than `RUSTC_LOG`. +pub fn init_env_logger(env: &str) { let builder = tracing_subscriber::FmtSubscriber::builder(); - let builder = builder.with_env_filter(tracing_subscriber::EnvFilter::from_env("RUSTC_LOG")); + let builder = builder.with_env_filter(tracing_subscriber::EnvFilter::from_env(env)); builder.init() } diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 62780878fd5a..002c5f967105 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -14,7 +14,6 @@ #![feature(never_type)] #![recursion_limit = "256"] -extern crate env_logger; #[macro_use] extern crate lazy_static; extern crate rustc_ast; @@ -90,7 +89,8 @@ pub fn main() { }; rustc_driver::set_sigpipe_handler(); rustc_driver::install_ice_hook(); - env_logger::init_from_env("RUSTDOC_LOG"); + rustc_driver::init_env_logger("RUSTDOC_LOG"); + let res = std::thread::Builder::new() .stack_size(thread_stack_size) .spawn(move || get_args().map(|args| main_args(&args)).unwrap_or(1)) From 720832c644d4dfe14ec43ae9ef4d74b647ccd77d Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sat, 25 Jul 2020 17:19:17 +0200 Subject: [PATCH 4/7] Update error index generator to tracing --- src/tools/error_index_generator/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index c4292d041d05..bd9f8fb04502 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -1,7 +1,7 @@ #![feature(rustc_private)] -extern crate env_logger; extern crate rustc_ast; +extern crate rustc_driver; extern crate rustc_span; use std::cell::RefCell; @@ -282,7 +282,7 @@ fn parse_args() -> (OutputFormat, PathBuf) { } fn main() { - env_logger::init(); + rustc_driver::init_env_logger("RUST_LOG"); let (format, dst) = parse_args(); let result = rustc_ast::with_default_session_globals(move || main_with_result(format, &dst)); if let Err(e) = result { From 358e21ee781cbcee19ff96b3824b583611e860a5 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sun, 26 Jul 2020 13:01:51 +0200 Subject: [PATCH 5/7] Disable log support --- Cargo.lock | 26 +------------------------- src/librustc_driver/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 367bf2ff0d92..46b13db01029 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4997,27 +4997,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-log" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" version = "0.2.10" @@ -5028,14 +5007,11 @@ dependencies = [ "chrono", "lazy_static", "matchers", + "parking_lot 0.9.0", "regex", - "serde", - "serde_json", "sharded-slab", "smallvec 1.4.0", "tracing-core", - "tracing-log", - "tracing-serde", ] [[package]] diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 69dd221ef969..2f6c2c6c22c2 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["dylib"] lazy_static = "1.0" libc = "0.2" log = { package = "tracing", version = "0.1.18", features = ["release_max_level_info"] } -tracing-subscriber = { version = "0.2.10", features = ["fmt", "env-filter"] } +tracing-subscriber = { version = "0.2.10", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi", "chrono"] } rustc_middle = { path = "../librustc_middle" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_target = { path = "../librustc_target" } From 401033c68486bc7672cc87e0f4c5b4862e96c778 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Tue, 28 Jul 2020 15:49:04 +0200 Subject: [PATCH 6/7] Don't register a tracing dispatcher if no tracing env var was set. --- src/librustc_driver/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 177fb2c2ec69..7af640c109ed 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1233,6 +1233,12 @@ pub fn init_rustc_env_logger() { /// log crate version. In contrast to `init_rustc_env_logger` it allows you to choose an env var /// other than `RUSTC_LOG`. pub fn init_env_logger(env: &str) { + // Don't register a dispatcher if there's no filter to print anything + match std::env::var(env) { + Err(_) => return, + Ok(s) if s.is_empty() => return, + Ok(_) => {} + } let builder = tracing_subscriber::FmtSubscriber::builder(); let builder = builder.with_env_filter(tracing_subscriber::EnvFilter::from_env(env)); From c7290379be40f930802f0deea87cdb313332e5cc Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sat, 1 Aug 2020 16:24:52 +0200 Subject: [PATCH 7/7] Remove chrono feature from tracing --- Cargo.lock | 1 - src/librustc_driver/Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 46b13db01029..7e90b7e6fba1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5004,7 +5004,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7b33f8b2ef2ab0c3778c12646d9c42a24f7772bee4cdafc72199644a9f58fdc" dependencies = [ "ansi_term 0.12.1", - "chrono", "lazy_static", "matchers", "parking_lot 0.9.0", diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 2f6c2c6c22c2..6474a69b216a 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["dylib"] lazy_static = "1.0" libc = "0.2" log = { package = "tracing", version = "0.1.18", features = ["release_max_level_info"] } -tracing-subscriber = { version = "0.2.10", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi", "chrono"] } +tracing-subscriber = { version = "0.2.10", default-features = false, features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"] } rustc_middle = { path = "../librustc_middle" } rustc_ast_pretty = { path = "../librustc_ast_pretty" } rustc_target = { path = "../librustc_target" }