summary refs log tree commit diff
path: root/src/librustdoc/lib.rs
AgeCommit message (Collapse)AuthorLines
2022-12-09Rollup merge of #105427 - ↵Matthias Krüger-2/+2
GuillaumeGomez:dont-silently-ignore-rustdoc-errors, r=notriddle Dont silently ignore rustdoc errors I applied the suggestions from https://github.com/rust-lang/rust/pull/104995 and also checked the rustdoc-ui error but couldn't reproduce it. r? `@notriddle`
2022-12-07Revert crate_types change, add new bin_crate fieldWill Crichton-2/+2
2022-12-07Improve several aspects of the Rustdoc scrape-examples UI.Will Crichton-1/+9
* Examples take up less screen height. * Snippets from binary crates are prioritized. * toggle-all-docs does not expand "More examples" sections.
2022-12-07Don't silently ignore errors that happen during renderingGuillaume Gomez-2/+2
2022-12-02Remove `-Zno-interleave-lints`.Nicholas Nethercote-4/+1
Because it complicates lint implementation greatly.
2022-11-19Rollup merge of #103117 - joshtriplett:use-is-terminal, r=eholkMatthias Krüger-2/+3
Use `IsTerminal` in place of `atty` In any crate that can use nightly features, use `IsTerminal` rather than `atty`: - Use `IsTerminal` in `rustc_errors` - Use `IsTerminal` in `rustc_driver` - Use `IsTerminal` in `rustc_log` - Use `IsTerminal` in `librustdoc`
2022-10-29rustdoc: add hash to filename of toolchain filesJacob Hoffman-Andrews-3/+1
All static files used by rustdoc are now stored in static.files/ and include a hash of their contents. They no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration.
2022-10-24rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`Martin Nordholts-1/+0
Start using `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`. After this has been merged, we can completely remove `rustc_driver::set_sigpipe_handler`. Verification of this change --------------------------- 1. Remove `#[unix_sigpipe = "sig_dfl"]` 1. Run `./x.py build` 1. Run `./build/aarch64-apple-darwin/stage1/bin/rustdoc --help | false` 1. Observe ICE 1. Add back `#[unix_sigpipe = "sig_dfl"]` 1. Run `./x.py build` 1. Run `./build/aarch64-apple-darwin/stage1/bin/rustdoc --help | false` 1. Observe ICE fixed
2022-10-19Avoid cloning `RenderOptions`.Nicholas Nethercote-6/+2
By moving `RenderOptions` out of `Option`, because the two structs' uses are almost entirely separate. The only complication is that `unstable_features` is needed in both structs, but it's a tiny `Copy` type so its duplication seems fine.
2022-10-19Use `interface::run_compiler` for `markdown::render`.Nicholas Nethercote-3/+10
It turns out `markdown::render` is more complex than it first appears, because it can invoke `doctest::make_test`, which requires session globals and a thread pool. So this commit changes it to use `interface::run_compiler`. Three of the four paths in `main_args` now use `interface::run_compiler`.
2022-10-19Merge `main_options` into `main_args`.Nicholas Nethercote-30/+27
There is no longer any need for them to be separate.
2022-10-19Clean up rustdoc startup.Nicholas Nethercote-7/+7
rustc's startup has several layers, including: - `interface::run_compiler` passes a closure, `f`, to `run_in_thread_pool_with_globals`, which creates a thread pool, sets up session globals, and passes `f` to `create_compiler_and_run`. - `create_compiler_and_run` creates a `Session`, a `Compiler`, sets the source map, and calls `f`. rustdoc is a bit different. - `main_args` calls `main_options` via `run_in_thread_pool_with_globals`, which (again) creates a thread pool (hardcoded to a single thread!) and sets up session globals. - `main_options` has four different paths. - The second one calls `interface::run_compiler`, which redoes the `run_in_thread_pool_with_globals`! This is bad. - The fourth one calls `interface::create_compiler_and_run`, which is reasonable. - The first and third ones don't do anything of note involving the above functions, except for some symbol interning which requires session globals. In other words, rustdoc calls into `rustc_interface` at three different levels. It's a bit confused, and feels like code where functionality has been added by different people at different times without fully understanding how the globally accessible stuff is set up. This commit tidies things up. It removes the `run_in_thread_pool_with_globals` call in `main_args`, and adjust the four paths in `main_options` as follows. - `markdown::test` calls `test::test_main`, which provides its own parallelism and so doesn't need a thread pool. It had one small use of symbol interning, which required session globals, but the commit removes this. - `doctest::run` already calls `interface::run_compiler`, so it doesn't need further adjustment. - `markdown::render` is simple but needs session globals for interning (which can't easily be removed), so it's now wrapped in `create_session_globals_then`. - The fourth path now uses `interface::run_compiler`, which is equivalent to the old `run_in_thread_pool_with_globals` + `create_compiler_and_run` pairing.
2022-10-16Use IsTerminal in librustdocJosh Triplett-2/+3
2022-09-27rustc_typeck to rustc_hir_analysislcnr-1/+1
2022-09-26remove cfg(bootstrap)Pietro Albini-2/+0
2022-09-23rustdoc: Stabilize --diagnostic-widthEric Huss-1/+1
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-08-30Stabilize GATsJack Huey-1/+1
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-07-29Remove box_syntax feature gate from librustdocest31-1/+0
2022-07-27session: disable internal lints for rustdocDavid Wood-1/+1
If an internal lint uses `typeck_results` or similar queries then that can result in rustdoc checking code that it shouldn't (e.g. from other platforms) and emit compilation errors. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-16Stabilize `let_chains`Caio-1/+1
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-3/+3
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-06session: `output-width` -> `diagnostic-width`David Wood-3/+3
Rename the `--output-width` flag to `--diagnostic-width` as this appears to be the preferred name within the compiler team. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06session: `terminal-width` -> `output-width`David Wood-4/+4
Rename the `--terminal-width` flag to `--output-width` as the behaviour doesn't just apply to terminals (and so is slightly less accurate). Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-06sess: stabilize `--terminal-width`David Wood-1/+14
Formerly `-Zterminal-width`, `--terminal-width` allows the user or build tool to inform rustc of the width of the terminal so that diagnostics can be truncated. Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-03Rollup merge of #98799 - jyn514:rustdoc-lint-help, r=GuillaumeGomezRalf Jung-8/+17
Fix bug in `rustdoc -Whelp` Previously, this printed the debugging options, not the lint options, and only handled `-Whelp`, not `-A/-D/-F`. This also fixes a few other misc issues: - Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests - Add lint headers for tool lints, not just builtin lints https://github.com/rust-lang/rust/pull/98533#issuecomment-1172004197 r? ```@GuillaumeGomez```
2022-07-02Fix bug in `rustdoc -Whelp`Joshua Nelson-8/+17
Previously, this printed the debugging options, not the lint options, and only handled `-Whelp`, not `-A/-D/-F`. This also fixes a few other misc issues: - Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests - Add lint headers for tool lints, not just builtin lints - Remove duplicate run-make test
2022-07-01update cfg(bootstrap)sPietro Albini-1/+0
2022-06-27Fix `rustdoc` argument errorShivani Bhardwaj-1/+1
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-1/+0
2022-06-03Fully stabilize NLLJack Huey-1/+1
2022-05-25update jemalloc-sys to jemalloc v5.3Rémy Rakic-3/+1
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-2/+1
2022-05-05Auto merge of #96630 - m-ysk:fix/issue-88038, r=notriddlebors-1/+1
Include nonexported macro_rules! macros in the doctest target Fixes #88038 This PR aims to include nonexported `macro_rules!` macros in the doctest target. For more details, please see the above issue.
2022-05-04Stabilize `bool::then_some`Josh Triplett-1/+0
2022-05-04ignore the doctest for mapYoshiki Matsuda-1/+1
2022-04-21[WIP] rustdoc: Resolve some more doc links earlyVadim Petrochenkov-0/+1
2022-04-07rustdoc: Early doc link resolution fixes and refactoringsVadim Petrochenkov-0/+1
2022-04-04Fix ICE in rustdoc intra doc links when trying to get traits in scope for a ↵Guillaume Gomez-1/+7
private module
2022-03-16rustc_error: make ErrorReported impossible to constructmark-5/+11
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-04Auto merge of #94009 - compiler-errors:gat-rustdoc, r=GuillaumeGomezbors-0/+1
Support GATs in Rustdoc Implements: 1. Rendering GATs in trait definitions and impl blocks 2. Rendering GATs in types (e.g. in the return type of a function) Fixes #92341 This is my first rustdoc PR, so I have absolutely no idea how to produce tests for this. Advice from the rustdoc team would be wonderful! I tested locally and things looked correct: ![image](https://user-images.githubusercontent.com/3674314/153988325-9732cbf3-0645-4e1a-9e64-ddfd93877b55.png)
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-5/+5
2022-02-27make GATs print properly in traitsMichael Goulet-0/+1
2022-02-25Auto merge of #94369 - matthiaskrgr:rollup-qtripm2, r=matthiaskrgrbors-0/+1
Rollup of 4 pull requests Successful merges: - #93850 (Don't ICE when an extern static is too big for the current architecture) - #94154 (Wire up unstable rustc --check-cfg to rustdoc) - #94353 (Fix debug_assert in unused lint pass) - #94366 (Add missing item to release notes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-02-25Rollup merge of #94154 - Urgau:rustdoc-check-cfg, r=GuillaumeGomezMatthias Krüger-0/+1
Wire up unstable rustc --check-cfg to rustdoc This pull-request wire up the new unstable `--check-cfg` option from `rustc` to `rustdoc` as [requested](https://github.com/rust-lang/rust/pull/93915#discussion_r807560445) in the [pull-request](https://github.com/rust-lang/rust/pull/93915) that introduce `--check-cfg`. The motivation was describe in the original PR by ``@jyn514`` who wrote https://github.com/rust-lang/rust/pull/89346#issuecomment-930129761: > > add plumbing to pass --check-cfg from rustdoc (do we want this one?) > > It would be useful, I think, it catches issues like cfg(doctst) or something (and in general I would like expansion to match rustc as closely as possible).
2022-02-25Switch bootstrap cfgsMark Rousskov-0/+1
2022-02-25Wire up --check-cfg to rustdocLoïc BRANSTETT-0/+1
2022-02-23rustc_errors: let `DiagnosticBuilder::emit` return a "guarantee of emission".Eduard-Mihai Burtescu-5/+3