rust/src/librustdoc
David Tolnay 00d3fdce7c
Allow linking rustc and rustdoc against the same single tracing crate
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-05-03 10:18:50 -07:00
..
clean Rollup merge of #140316 - nnethercote:BoxMarker, r=dtolnay 2025-04-28 13:30:45 +02:00
doctest rustdoc: Fix doctest heuristic for main fn wrapping 2025-05-01 11:56:11 +02:00
formats librustdoc: remove IndexItem::new, use previous fields constructor 2025-04-09 20:51:52 +08:00
html Rollup merge of #140248 - GuillaumeGomez:fix-impl-block-items-indent, r=notriddle 2025-04-25 00:54:01 +02:00
json Make rustdoc JSON Span column 1-based, just like line numbers 2025-04-18 20:32:40 +02:00
passes Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmease 2025-04-25 00:53:58 +02:00
theme rustdoc: merge theme css into rustdoc.css 2023-09-15 07:40:17 -07:00
askama.toml Update to new rinja version (askama) 2025-04-03 15:38:08 +02:00
build.rs Auto merge of #136253 - notriddle:notriddle/aot-minify, r=GuillaumeGomez 2025-02-05 18:28:16 +00:00
Cargo.toml Update to new rinja version (askama) 2025-04-03 15:38:08 +02:00
config.rs Remove and stabilize --enable-per-target-ignores 2025-03-27 19:06:48 -07:00
core.rs Rollup merge of #139615 - nnethercote:rm-name_or_empty, r=jdonszelmann 2025-04-18 05:16:29 +02:00
display.rs x clippy src/librustdoc --fix 2025-03-06 16:06:41 +00:00
docfs.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
doctest.rs Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmease 2025-04-25 00:53:58 +02:00
error.rs Fix clippy lints 2024-08-29 12:14:41 +02:00
externalfiles.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
fold.rs Rename TyMethodItem -> RequiredMethodItem 2024-12-19 10:48:51 -08:00
lib.rs Allow linking rustc and rustdoc against the same single tracing crate 2025-05-03 10:18:50 -07:00
lint.rs Fix new clippy lints 2024-11-28 03:05:43 +01:00
markdown.rs rustdoc: Document markdown module. 2024-10-19 13:37:40 +00:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
scrape_examples.rs Move methods from Map to TyCtxt, part 5. 2025-04-02 10:00:46 +11:00
theme.rs Fix new clippy lints 2024-11-28 03:05:43 +01:00
visit.rs Rename TyMethodItem -> RequiredMethodItem 2024-12-19 10:48:51 -08:00
visit_ast.rs Move hir::Item::ident into hir::ItemKind. 2025-03-18 06:29:50 +11:00
visit_lib.rs librustdoc: flatten nested ifs 2025-03-06 08:16:28 +00:00

For more information about how librustdoc works, see the rustc dev guide.