about summary refs log tree commit diff
path: root/src/librustdoc/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-09-29Use `Iterator::eq` and (dogfood) `eq_by` in compiler and libraryYotam Ofek-0/+1
2025-09-26Apply cfg(bootstrap) replacementMark Rousskov-1/+0
2025-09-22Rollup merge of #146828 - el-ev:issue146646, r=GuillaumeGomezGuillaume Gomez-2/+4
fix a crash in rustdoc merge finalize without input file - Closes rust-lang/rust#146646 `SerializedSearchIndex::union` calls `Symbol::intern`, requiring `SESSION_GLOBALS` to be set.
2025-09-22Introduce "wrapper" helpers to rustdocYotam Ofek-0/+1
2025-09-21fix a crash in rustdoc merge finalize without input fileIris Shi-2/+4
2025-09-08mark `format_args_nl!` as `#[doc(hidden)]`cyrgani-1/+0
2025-08-29Rollup merge of #146000 - GuillaumeGomez:rustdoc-error-improvement, r=notriddleTrevor Gross-1/+3
Improve librustdoc error when a file creation/modification failed The message before looks like this: ``` failed to create or modify "/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/search.index/entry/" ``` And with this change it looks like this: ``` failed to create or modify "/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/search.index/entry/": failed to read column from disk: data consumer error: missing field `unknown number` at line 1 column 8 ``` r? ``````@lolbinarycat``````
2025-08-29Rollup merge of #145756 - okaneco:stabilize_char_boundary, r=scottmcmTrevor Gross-1/+1
str: Stabilize `round_char_boundary` feature Closes https://github.com/rust-lang/rust/issues/93743 FCP completed https://github.com/rust-lang/rust/issues/93743#issuecomment-3168382171
2025-08-29Improve librustdoc error when a file creation/modification failedGuillaume Gomez-1/+3
2025-08-26Rollup merge of #145535 - lolbinarycat:rustdoc-invalid_html_tags-svg-145529, ↵Stuart Cook-0/+1
r=GuillaumeGomez make rustdoc::invalid_html_tags more robust best reviewed a commit at a time. I kept finding more edge case so I ended up having to make quite significant changes to the parser in order to make it preserve state across events and handle multiline attributes correctly. fixes rust-lang/rust#145529
2025-08-23Improve code and add test with macro coming from another file from the same ↵Guillaume Gomez-17/+9
crate
2025-08-23Do macro expansion at AST level rather than HIRGuillaume Gomez-7/+43
2025-08-23Add new unstable `--generate-macro-expansion` rustdoc command line flagGuillaume Gomez-0/+8
2025-08-22Stabilize `round_char_boundary` featureokaneco-1/+1
2025-08-21refactor rustdoc::invalid_html_tags tag parserbinarycat-0/+1
previously, this lint did not distinguish between `<img` and `<img>`, and since the latter should be accepted under html5, the former was also accepted. the parser now also handles multi-line tags and multi-line attributes.
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-1/+0
2025-07-28Ensure external paths passed via flags end up in rustdoc depinfoNoratrieb-1/+7
rustdoc has many flags to pass external HTML/Markdown/CSS files that end up in the build. These need to be recorded in depinfo so that Cargo will rebuild the crate if they change.
2025-06-28librustdoc: use tidy for sorting attrs and depsYotam Ofek-1/+3
2025-06-28librustdoc: remove unused feature gatesYotam Ofek-4/+0
2025-06-28librustdoc: remove unneeded `#[recursion_limit]`Yotam Ofek-1/+0
2025-06-28librustdoc: remove unneeded `#[allow]`sYotam Ofek-3/+0
2025-05-23Simplify `format_integer_with_underscore_sep`Yotam Ofek-0/+2
Only ever needs to handle decimal reprs
2025-05-19Rollup merge of #140874 - mejrs:rads, r=WaffleLapkinStuart Cook-0/+1
make `rustc_attr_parsing` less dominant in the rustc crate graph It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly. Previous graph: ![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd) Graph with this PR: ![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a) The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*. The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-0/+1
2025-05-16Remove #![feature(let_chains)] from library and src/librustdocest31-1/+0
2025-05-09Rollup merge of #140815 - yaahc:rustdoc-metrics, r=GuillaumeGomezMatthias Krüger-0/+19
also export metrics from librustdoc Addresses the issue mentioned here: [#t-docs-rs > metrics intitiative @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/356853-t-docs-rs/topic/metrics.20intitiative/near/515714331) The previous implementation only emitted metrics from rustc, but it turns out running `cargo doc` only calls `rustc` for dependencies, and not for the root crate being documented. We are planning to gather a sample dataset from docs.rs ci via `cargo doc` so as things stood this would not emit any metrics for any of the crates themselves that were published. This change adds the same logic from `rustc_driver_impl` to `librustdoc` to also dump metrics at the end of its execution if they are enabled. Note: The hash's generated by librustdoc will likely be completely different from the ones generated by rustc. This is because rustc is actually doing the various passes needed to fully calculate the stable version hash. My understanding of how rustdoc works is that the hashes generated will be working with partial information due to it only doing the work required to generate docs. The hashes will still be unique per crate and will work for the purposes of the metrics proof of concept, it would not be possible to correlate metrics generated by rustdoc with those generated by rustc for the same crate. This is fine for the purposes of the PoC but a future full implementation of metrics may want to address this issue.
2025-05-09Rollup merge of #139863 - fmease:simp-doctest-build-arg-passing, ↵Matthias Krüger-3/+3
r=GuillaumeGomez rustdoc: Replace unstable flag `--doctest-compilation-args` with a simpler one: `--doctest-build-arg` Tracking issue: https://github.com/rust-lang/rust/issues/134172. Context: https://github.com/rust-lang/rust/pull/137096#issuecomment-2776318800 Yeets the ad hoc shell-like lexer for 'nested' program arguments. No FCP necessary since the flag is unstable. I've chosen to replace `compilation` with `build` because it's shorter (you now need to pass it multiple times in order to pass many arguments to the doctest compiler, so it matters a bit) and since I prefer it esthetically. **Issue**: Even though we don't process the argument passed to `--doctest-build-arg`, we end up passing it via an argument file (`rustc `@argfile`)` which delimits arguments by line break (LF or CRLF, [via](https://doc.rust-lang.org/rustc/command-line-arguments.html#path-load-command-line-flags-from-a-path)) meaning ultimately the arguments still get split which is unfortunate. Still, I think this change is an improvement over the status quo. I'll update the tracking issue if/once this PR merges. I'll also add the (CR)LF issue to 'unresolved question'. r? GuillaumeGomez r? notriddle
2025-05-08also export metrics from librustdocJane Losare-Lusby-0/+19
2025-05-03Allow linking rustc and rustdoc against the same single tracing crateDavid Tolnay-5/+21
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-04-15Replace flag `--doctest-compilation-args` with a simpler one: ↵León Orell Valerian Liehr-3/+3
`--doctest-build-arg` More notably, the value of the new flag does *not* get lexed shell-like and ad hoc.
2025-04-14Fix grammar of --test-runtool-arg help textEric Huss-1/+1
2025-03-27Remove and stabilize --enable-per-target-ignoresEric Huss-8/+0
This removes the `--enable-per-target-ignores` and enables it unconditionally.
2025-03-27Stabilize --test-runtool and --test-runtool-argEric Huss-2/+2
2025-03-27Rename `--runtool` and `--runtool-arg`Eric Huss-2/+2
This renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments.
2025-03-04`librustdoc`: 2024 edition! 🎊Yotam Ofek-1/+1
2025-02-26Add rustdoc support for `--emit=dep-info[=path]`Guillaume Gomez-2/+8
2025-02-20Stabilise `os_str_display`riverbl-1/+0
2025-02-14librustdoc: create `MaybeDisplay` helper for `Option<T: Display>` typesYotam Ofek-1/+1
2025-02-12Nuke `Buffer` abstraction from `librustdoc` 💣Yotam Ofek-0/+1
2025-02-05Auto merge of #136244 - yotamofek:pr/rustdoc-join-iter, r=GuillaumeGomezbors-0/+1
librustdoc: create a helper for separating elements of an iterator instead of implementing it multiple times This implements something similar to [`Itertools::format`](https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.format), but on `Fn`s returning iterators instead of directly on iterators, to allow implementing `Display` without the use of a `Cell` (to handle the possibility of `fmt` being called multiple times while receiving `&self`). ~This is WIP, I just want to get a perf run first to see if the regression I saw in #135494 is fixed~ This was originally part of #135494 , but originally caused a perf regression that was since fixed: https://github.com/rust-lang/rust/blob/7d5ae1863aa66847a4edf8d2ef9420717df65c5d/src/librustdoc/html/format.rs#L507
2025-02-04librustdoc: create a helper for separating elements of an iterator instead ↵Yotam Ofek-0/+1
of implementing it multiple times
2025-02-04Rollup merge of #134807 - poliorcetics:ab/push-skpynvsmwkll, r=camelidMatthias Krüger-2/+2
fix(rustdoc): always use a channel when linking to doc.rust-lang.org Closes #131971 I manually checked the resulting links One issue is that this will create `nightly/...` links in places that formerly linked to stable, is that ok ? (the `slice` and `array` links in the search help notably)
2025-02-02Some cleanups around EarlyDiagCtxtbjorn3-2/+1
All callers of EarlyDiagCtxt::early_error now emit a fatal error.
2025-01-30fix(rustdoc): always use a channel when linking to doc.rust-lang.orgAlexis (Poliorcetics) Bourget-2/+2
2025-01-29Add new output-formatGuillaume Gomez-2/+8
2025-01-23Rollup merge of #135880 - bjorn3:misc_driver_refactors, r=oli-obkMatthias Krüger-12/+5
Get rid of RunCompiler The various `set_*` methods that have been removed can be replaced by setting the respective fields in the `Callbacks::config` implementation. `set_using_internal_features` was often forgotten and it's equivalent is now done automatically.
2025-01-23Remove the need to manually call set_using_internal_featuresbjorn3-12/+5
2025-01-22rustdoc: use std's (unstable) `fmt::from_fn` instead of open-coding itYotam Ofek-0/+1
2025-01-14fix typo and unit testbinarycat-1/+1
2025-01-14add disclaimer to --disable-minificationbinarycat-1/+1