about summary refs log tree commit diff
path: root/src/librustdoc/config.rs
AgeCommit message (Collapse)AuthorLines
2025-09-04Rollup merge of #146161 - GuillaumeGomez:loaded-paths-scraped-examples, ↵Stuart Cook-1/+2
r=lolbinarycat [rustdoc] Uncomment code to add scraped rustdoc examples in loaded paths Since the bug was fixed in https://github.com/rust-lang/rust/pull/146091, we can now uncomment the code. :) r? lolbinarycat
2025-09-03Uncomment code to add scraped rustdoc examples in loaded pathsGuillaume Gomez-1/+2
2025-09-03fix(rustdoc): match rustc `--emit` precedenceWeihang Lo-2/+9
Change rustdoc's `--emit` to allow only one instance of each type, regardless of the actual data that `--emit` carries. This matches rustc's `--emit` behavior. As of the writing, only `dep-info` emit type carries extra data. See <https://github.com/rust-lang/rust/issues/141664>
2025-08-23Add new unstable `--generate-macro-expansion` rustdoc command line flagGuillaume Gomez-0/+11
2025-08-06Fix rustdoc scrape-examples feature crashGuillaume Gomez-2/+1
2025-07-29Rollup merge of #144600 - Noratrieb:rustdoc-dep-info-paths, r=GuillaumeGomezStuart Cook-7/+13
Ensure external paths passed via flags end up in rustdoc depinfo 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-07-28Ensure external paths passed via flags end up in rustdoc depinfoNoratrieb-7/+13
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-07-27rustdoc: save target modifiersMiguel Ojeda-0/+4
`rustdoc` was filling a `target_modifiers` variable, but it was not using the result. In turn, that means that trying to use a dependency that set a target modifier fails. For instance, running: ```sh RUSTC_BOOTSTRAP=1 rustc --edition=2024 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null --emit=metadata -Zfixed-x18 --crate-type rlib --crate-name core $(rustc --print sysroot)/lib/rustlib/src/rust/library/core/src/lib.rs echo '#![allow(internal_features)] ' | RUSTC_BOOTSTRAP=1 rustdoc --edition=2021 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null -Zfixed-x18 --extern core=libcore.rmeta - ``` will fail with: ```text error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error ``` Thus save the targets modifiers in `Options` to then pass it to the session options, so that eventually the diff can be performed as expected in `report_incompatible_target_modifiers()`. Fixes: https://github.com/rust-lang/rust/issues/144521 Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-06-24rustc_session: Add a structure for keeping both explicit and default sysrootsVadim Petrochenkov-10/+4
Also avoid creating and cloning sysroot unnecessarily.
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-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-03-27Remove and stabilize --enable-per-target-ignoresEric Huss-7/+0
This removes the `--enable-per-target-ignores` and enables it unconditionally.
2025-03-27Rename `--runtool` and `--runtool-arg`Eric Huss-8/+8
This renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments.
2025-03-12Use materialize_sysroot in rustdocbjorn3-4/+1
2025-03-12Don't return an error from get_or_default_sysrootbjorn3-3/+1
All callers unwrap the result.
2025-03-12Make opts.maybe_sysroot non-optionalbjorn3-0/+4
build_session_options always uses materialize_sysroot anyway.
2025-03-06`librustdoc`: flatten nested ifsYotam Ofek-8/+8
2025-02-26Add rustdoc support for `--emit=dep-info[=path]`Guillaume Gomez-6/+22
2025-02-05Auto merge of #136253 - notriddle:notriddle/aot-minify, r=GuillaumeGomezbors-2/+2
rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address https://github.com/rust-lang/rust/pull/136161#issuecomment-2622069453
2025-02-03Auto merge of #133138 - azhogin:azhogin/target-modifiers, r=davidtwco,saethlinbors-4/+5
Target modifiers (special marked options) are recorded in metainfo Target modifiers (special marked options) are recorded in metainfo and compared to be equal in different linked crates. PR for this RFC: https://github.com/rust-lang/rfcs/pull/3716 Option may be marked as `TARGET_MODIFIER`, example: `regparm: Option<u32> = (None, parse_opt_number, [TRACKED TARGET_MODIFIER]`. If an TARGET_MODIFIER-marked option has non-default value, it will be recorded in crate metainfo as a `Vec<TargetModifier>`: ``` pub struct TargetModifier { pub opt: OptionsTargetModifiers, pub value_name: String, } ``` OptionsTargetModifiers is a macro-generated enum. Option value code (for comparison) is generated using `Debug` trait. Error example: ``` error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` --> $DIR/incompatible_regparm.rs:10:1 | LL | #![crate_type = "lib"] | ^ | = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: `-Zregparm=1` in this crate is incompatible with `-Zregparm=2` in dependency `wrong_regparm` = help: set `-Zregparm=2` in this crate or `-Zregparm=1` in `wrong_regparm` = help: if you are sure this will not cause problems, use `-Cunsafe-allow-abi-mismatch=regparm` to silence this error error: aborting due to 1 previous error ``` `-Cunsafe-allow-abi-mismatch=regparm,reg-struct-return` to disable list of flags.
2025-02-02Target modifiers (special marked options) are recorded in metainfo and ↵Andrew Zhogin-4/+5
compared to be equal in different crates
2025-01-29rustdoc: run css and html minifier at build instead of runtimeMichael Howell-2/+2
This way, adding a bunch of comments to the JS files won't make rustdoc slower.
2025-01-29Improve check for `--output-format` combinations and add ui regression testGuillaume Gomez-31/+35
2025-01-29Improve code and add missing docs for new `doctest::extracted` moduleGuillaume Gomez-6/+4
2025-01-29Mention the tracking issue of `--output-format=doctest`Guillaume Gomez-0/+2
2025-01-29Add new output-formatGuillaume Gomez-2/+12
2025-01-11re-add --disable-minification to rustdocbinarycat-0/+6
this also makes the rust.docs-minification option work as advertised in config.toml nothing fancy this time, this is intended to be perma-unstable. it's only really here for the benefit of rustdoc devs. mitegates https://github.com/rust-lang/rust/issues/135345
2024-12-20Add `--doctest-compilation-args` option to allow passing arguments to ↵Guillaume Gomez-0/+5
doctest compilation
2024-11-28Fix new clippy lintsGuillaume Gomez-2/+2
2024-11-02Rename target triple to target tuple in many places in the compilerNoratrieb-2/+2
This changes the naming to the new naming, used by `--print target-tuple`. It does not change all locations, but many.
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-2/+2
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-5/+5
2024-09-07rfc#3662 changes under unstable flagsEtomicBomb-4/+105
* All new functionality is under unstable options * Adds `--merge=shared|none|finalize` flags * Adds `--parts-out-dir=<crate specific directory>` for `--merge=none` to write cross-crate info file for a single crate * Adds `--include-parts-dir=<previously specified directory>` for `--merge=finalize` to write cross-crate info files * update tests/run-make/rustdoc-default-output/rmake.rs golden
2024-09-07librustdoc::config: removed Input from OptionsEtomicBomb-12/+6
The `librustdoc::config::Options` struct no longer includes `rustc_session::config::Input`. This is so that Input can be optional. In rfc#3662, the crate input is not required if `--merge=finalize`. Replacing Input with Option<Input> was decided against. In most places that Input is needed, it should be statically known to not be optional (means fewer unwraps). We just want to have an Input-free Options in librustdoc::main_args, where we can run the write shared procedure.
2024-08-29Fix clippy lintsGuillaume Gomez-3/+3
2024-08-15Rollup merge of #128963 - GuillaumeGomez:output-to-stdout, r=aDotInTheVoidMatthias Krüger-5/+10
Add possibility to generate rustdoc JSON output to stdout Fixes #127165. I think it's likely common to want to get rustdoc json output directly instead of reading it from a file so I added this option to allow it. It's unstable and only works with `--output-format=json`. r? `@aDotInTheVoid`
2024-08-13Emit a warning instead of an error if `--generate-link-to-definition` is ↵Guillaume Gomez-3/+5
used with other output formats than HTML
2024-08-12Add possibility to generate rustdoc JSON output to stdoutGuillaume Gomez-5/+10
2024-08-08Split `ColorConfig` off of `HumanReadableErrorType`Esteban Küber-2/+3
The previous setup tied two unrelated things together. Splitting these two is a better model.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-13/+7
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-7/+9
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-09rustdoc: Add support for --remap-path-prefixEdward Shen-0/+26
Adds --remap-path-prefix as an unstable option. This is implemented to mimic the behavior of rustc's --remap-path-prefix but with minor adjustments. This flag similarly takes in two paths, a prefix to replace and a replacement string.
2024-05-18Auto merge of #124611 - Urgau:rustdoc-stdin, r=GuillaumeGomezbors-14/+37
Add `-` (stdin) support in rustdoc This PR adds support for the special `-` input which threats the input as coming from *stdin* instead of being a filepath. Doing this also makes `rustdoc` consistent with `rustc` and ~~every~~ other tools. Full [motivation](https://github.com/rust-lang/rust/pull/124611#issuecomment-2094234876). Fixes https://github.com/rust-lang/rust/issues/123671 r? `@fmease`
2024-05-07rustdoc: use stability, instead of features, to decide what to showMichael Howell-4/+0
To decide if internal items should be inlined in a doc page, check if the crate is itself internal, rather than if it has the rustc_private feature flag. The standard library uses internal items, but is not itself internal and should not show internal items on its docs pages.
2024-05-04Simplify `markdown_input` fn and subsequent logicUrgau-4/+3
2024-05-04Add `-` (stdin) support to rustdocUrgau-13/+37
2024-04-23Mark @RUSTC_BUILTIN search path usage as unstableLukas Wirth-1/+10
2024-03-25Make sysroot mandatory for rustdocLukas Wirth-1/+8
2024-03-25Make use of sysroot in librustdoc/config.rs for builtin:$pathLukas Wirth-2/+2
2024-03-25Implement `-L builtin:$path`Lukas Wirth-2/+6