about summary refs log tree commit diff
path: root/compiler/rustc_log/src
AgeCommit message (Collapse)AuthorLines
2025-06-12Add documentation for init_logger_with_additional_layerStypox-3/+8
2025-06-11Use closure to allow passing custom tracing layersStypox-8/+22
The previous method, where a layer would be passed directly, required to pass a "no-op" layer when no custom layer was needed. This should have in theory worked, however having a no-op layer seems to change the way the tracing lib applies filters internally, leading to some debug!() being printed despite them being out of the minimum level for the filters. Note however that this behavior was very inconsistent, and e.g. some debug!() would get printed and some others wouldn't, for no apparent reason.
2025-06-11Allow initializing logger with additional tracing LayerStypox-3/+15
2025-05-03Allow linking rustc and rustdoc against the same single tracing crateDavid Tolnay-2/+11
By consecutively initializing `tracing` and `rustc_log`, Rustdoc assumes that these involve 2 different tracing crates. I would like to be able to build rustdoc against the same tracing crate that rustc_log is also built against. Previously this arrangement would crash rustdoc: thread 'main' panicked at rust/compiler/rustc_log/src/lib.rs:142:65: called `Result::unwrap()` on an `Err` value: SetGlobalDefaultError("a global default trace dispatcher has already been set") stack backtrace: 0: rust_begin_unwind 1: core::panicking::panic_fmt 2: core::result::unwrap_failed 3: rustc_log::init_logger 4: rustc_driver_impl::init_logger 5: rustdoc::main note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. error: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md note: please make sure that you have updated to the latest nightly query stack during panic: end of query stack
2025-03-20Use `-Wunused_crate_dependencies` for compiler crates.Nicholas Nethercote-6/+1
It's very useful. There are some false positives involving integration tests in `rustc_pattern_analysis` and `rustc_serialize`. There is also a false positive involving `rustc_driver_impl`'s `rustc_randomized_layouts` feature. And I removed a `rustc_span` mention in a doc comment in `rustc_log` because it wasn't integral to the comment but caused a dev-dependency.
2025-01-07Avoid naming variables `str`Josh Triplett-2/+2
This renames variables named `str` to other names, to make sure `str` always refers to a type. It's confusing to read code where `str` (or another standard type name) is used as an identifier. It also produces misleading syntax highlighting.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-4/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-12Bump tracing-tree and allow rendering lines againOli Scherer-0/+8
2024-05-30remove tracing tree indent lineslcnr-1/+0
2024-05-21Use Backtrace::force_capture instead of Backtrace::capture in rustc_logMichael Woerister-1/+3
2024-04-16Construct `SourceMap` at the same time as `SessionGlobals`.Nicholas Nethercote-1/+1
Currently `SourceMap` is constructed slightly later than `SessionGlobals`, and inserted. This commit changes things so they are done at the same time. Benefits: - `SessionGlobals::source_map` changes from `Lock<Option<Lrc<SourceMap>>>` to `Option<Lrc<SourceMap>>`. It's still optional, but mutability isn't required because it's initialized at construction. - `set_source_map` is removed, simplifying `run_compiler`, which is good because that's a critical function and it's nice to make it simpler. This requires moving things around a bit, so the necessary inputs are available when `SessionGlobals` is created, in particular the `loader` and `hash_kind`, which are no longer computed by `build_session`. These inputs are captured by the new `SourceMapInputs` type, which is threaded through various places.
2024-03-03rustc_log: expose tracing-tree "wraparound" in an env varRalf Jung-1/+18
2024-02-06Invert diagnostic lints.Nicholas Nethercote-3/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2023-11-11rustc_log: provide a way to init logging based on the values, not names, of ↵Ralf Jung-11/+34
the env vars
2023-10-10use env variable to control thread ids in rustc_logSparrowLii-3/+8
2023-10-02Fix a comment.Nicholas Nethercote-2/+2
Compiling any part of the compiler will almost certainly require Nightly.
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-1/+1
2023-04-10Stabilize IsTerminalJosh Triplett-1/+0
closes: https://github.com/rust-lang/rust/issues/98070
2023-04-04write threads info into log only when debuggingSparrowLii-1/+1
2023-02-11Rollup merge of #107895 - matthiaskrgr:cl, r=compiler-errorsMatthias Krüger-1/+1
remove redundant clones
2023-02-10remove redundant clonesMatthias Krüger-1/+1
2023-02-10fix rustc_log doctestRalf Jung-3/+3
2023-02-09avoid duplicating the RUSTC_LOG env var nameRalf Jung-6/+0
2023-02-07Replace a command line flag with an env var to allow tools to initialize the ↵Oli Scherer-17/+4
tracing loggers at their own discretion
2023-01-12Add log-backtrace option to show backtraces along with loggingYuki Omoto-2/+56
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-2/+1
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-10-16Use IsTerminal in rustc_logJosh Triplett-3/+4
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+3
2022-05-26clippy::complexity fixesMatthias Krüger-7/+1
clone_on_copy useless_format bind_instead_of_map filter_map_identity useless_conversion map_flatten unnecessary_unwrap
2022-05-11rustc_log: add env var to set verbose entry/exit behaviorRalf Jung-0/+13
2022-01-03Make rustc_log doc test runnableDavid Tolnay-1/+1
2022-01-03Justify why rustc_log existsDavid Tolnay-0/+37
2022-01-03Extract init_env_logger to crateDavid Tolnay-0/+78