about summary refs log tree commit diff
path: root/compiler/rustc_log
AgeCommit message (Collapse)AuthorLines
2025-09-08Update tracing, againDaniel Paoliello-3/+2
2025-09-04rustc_log: remove direct dep on tracing_coreklensy-1/+1
required features reexported from tracing
2025-09-04unpin tracing_coreklensy-2/+2
2025-09-02Revert introduction of `[workspace.dependencies]`.Nicholas Nethercote-1/+1
This was done in #145740 and #145947. It is causing problems for people using r-a on anything that uses the rustc-dev rustup package, e.g. Miri, clippy. This repository has lots of submodules and subtrees and various different projects are carved out of pieces of it. It seems like `[workspace.dependencies]` will just be more trouble than it's worth.
2025-08-27Add `tracing` to `[workspace.dependencies]`.Nicholas Nethercote-1/+1
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-11/+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-03-10Revert "Use workspace lints for crates in `compiler/` #138084"许杰友 Jieyou Xu (Joe)-3/+0
Revert <https://github.com/rust-lang/rust/pull/138084> to buy time to consider options that avoids breaking downstream usages of cargo on distributed `rustc-src` artifacts, where such cargo invocations fail due to inability to inherit `lints` from workspace root manifest's `workspace.lints` (this is only valid for the source rust-lang/rust workspace, but not really the distributed `rustc-src` artifacts). This breakage was reported in <https://github.com/rust-lang/rust/issues/138304>. This reverts commit 48caf81484b50dca5a5cebb614899a3df81ca898, reversing changes made to c6662879b27f5161e95f39395e3c9513a7b97028.
2025-03-08Specify rust lints for `compiler/` crates via Cargo.Nicholas Nethercote-0/+3
By naming them in `[workspace.lints.rust]` in the top-level `Cargo.toml`, and then making all `compiler/` crates inherit them with `[lints] workspace = true`. (I omitted `rustc_codegen_{cranelift,gcc}`, because they're a bit different.) The advantages of this over the current approach: - It uses a standard Cargo feature, rather than special handling in bootstrap. So, easier to understand, and less likely to get accidentally broken in the future. - It works for proc macro crates. It's a shame it doesn't work for rustc-specific lints, as the comments explain.
2025-02-22Upgrade the compiler to edition 2024Michael Goulet-1/+1
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-1/+9
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-30bump tracing-tree to 0.3klensy-1/+1
Only change is https://github.com/davidbarsky/tracing-tree/pull/76 dedupes tracing-log dupes nu-ansi-term
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-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-1/+7
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
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-07-02Downgrade tracing and synNilstrieb-1/+1
There's currently a deadlock with tracing when RUSTC_LOG is enabled. Downgrade tracing-core for now to avoid blocking the other updates. syns upgrades cause some nontrivial changes in the diagnostics derive tests, which are best dealt with in another PR.
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/+57
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-4/+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-4/+4
2022-01-03Justify why rustc_log existsDavid Tolnay-0/+37
2022-01-03Extract init_env_logger to crateDavid Tolnay-0/+94