about summary refs log tree commit diff
path: root/src/librustdoc/lib.rs
AgeCommit message (Collapse)AuthorLines
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-5/+5
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
2022-02-18Rollup merge of #93497 - willcrichton:rustdoc-scrape-test, r=GuillaumeGomezMatthias Krüger-0/+3
Pass `--test` flag through rustdoc to rustc so `#[test]` functions can be scraped As a part of stabilizing the scrape examples extension in Cargo, I uncovered a bug where examples cannot be scraped from tests. See this test: https://github.com/rust-lang/cargo/pull/10343/files#diff-27aa4f012ebfebaaee61498d91d2370de460628405d136b05e77efe61e044679R2496 The issue is that when rustdoc is run on a test file, because `--test` is not passed as a rustc option, then functions annotated with `#[test]` are ignored by the compiler. So this PR changes rustdoc so when `--test` is passed in conjunction with a `--scrape-example-<suffix>` flag, then the `test` field of `rustc_interface::Config` is true. r? `@camelid`
2022-02-13Remove Config::stderrbjorn3-1/+0
1. It captured stdout and not stderr 2. It isn't used anywhere 3. All error messages should go to the DiagnosticOutput instead 4. It modifies thread local state
2022-02-12Move setup_callbacks call to create_compiler_and_runbjorn3-1/+1
This ensures that it is called even when run_in_thread_pool_with_globals is avoided and reduces code duplication between the parallel and non-parallel version of run_in_thread_pool_with_globals
2022-02-11Add --scrape-tests flags so rustdoc can scrape examples from testsWill Crichton-0/+3
2022-02-01rustdoc: correct unclosed HTML tags as genericsMichael Howell-0/+1
2022-01-25Auto merge of #92353 - Kobzol:doc-attr-lists-gat, r=GuillaumeGomezbors-0/+2
Rustdoc: remove ListAttributesIter and use impl Iterator instead This is a continuation of https://github.com/rust-lang/rust/pull/92227. I found that `ListAttributesIter` did not optimize well and replacing it with a simple `impl Iterator` resulted in 1-3 % instruction count wins locally. Because I needed to use `impl Iterator` on a slice of AST attributes, I had to implement it using GAT + impl trait. I also have a version without GAT [here](https://github.com/Kobzol/rust/commit/5470e2a65cbd3086d19f0847f44ca9cbbc049689), if GATs are not welcome in rustdoc :D Locally it resulted in equal performance numbers. Can I ask for a perf. run? Thanks. r? rust-lang/rustdoc
2022-01-17Rollup merge of #92819 - euclio:atty, r=CraftSpiderMatthias Krüger-41/+15
rustdoc: remove hand-rolled isatty This PR replaces bindings to the platform-specific isatty APIs with the `isatty` crate, as done elsewhere in the repository.
2022-01-15Rustdoc: remove ListAttributesIter and use impl Iterator insteadJakub Beránek-0/+2
2022-01-13librustdoc: Address some clippy lintspierwill-0/+1
Also ignore clippy's "collapsible if..." lints.
2022-01-13rustdoc: remove hand-rolled isattyAndy Russell-41/+15
2022-01-07rustdoc: Introduce a resolver cache for sharing data between early doc link ↵Vadim Petrochenkov-1/+11
resolution and later passes
2021-12-28remove in_band_lifetimes from librustdocMichael Goulet-1/+0
2021-12-23Auto merge of #92222 - nnethercote:rm-global_allocator-rustc-rustdoc, ↵bors-15/+3
r=alexcrichton Remove useless `#[global_allocator]` from rustc and rustdoc. This was added in #83152, which has several errors in its comments. This commit also fix up the comments, which are quite wrong and misleading. r? `@alexcrichton`
2021-12-23Remove useless `#[global_allocator]` from rustc and rustdoc.Nicholas Nethercote-15/+3
This was added in #83152, which has several errors in its comments. This commit also fix up the comments, which are quite wrong and misleading.
2021-12-15rustdoc: remove `--passes` and `--no-defaults`Peter Jaszkowiak-19/+46
- flags no longer function, see #44136 - adjust tests to match new behavior - removed test issue-42875 (covered regression with --no-defaults) - moved input-format to removed flags - move all removed flags to bottom - note flag removal in command help - remove DefaultPassOption enum (now redundant with `show_coverage`)
2021-11-30Add --out-dir flag for rustdochi-rustin-1/+10
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-11-13Delete rustdoc::doctreehi-rustin-1/+0
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-11-11Auto merge of #90489 - jyn514:load-all-extern-crates, r=petrochenkovbors-1/+2
rustdoc: Go back to loading all external crates unconditionally This *continues* to cause regressions. This code will be unnecessary once access to the resolver happens fully before creating the tyctxt (#83761), so load all crates unconditionally for now. To minimize churn, this leaves in the code for loading crates selectively. "Fixes" https://github.com/rust-lang/rust/issues/84738. Previously: https://github.com/rust-lang/rust/pull/83738, https://github.com/rust-lang/rust/pull/85749, https://github.com/rust-lang/rust/pull/88215 r? `@petrochenkov` cc `@camelid` (this should fix the "index out of bounds" error you had while looking up `crate_name`).
2021-11-09Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995bors-1/+1
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
2021-11-08Auto merge of #90443 - camelid:rustdoc-subst, r=GuillaumeGomezbors-0/+1
Merge `DocContext.{ty,lt,ct}_substs` into one map It should be impossible to have more than one entry with a particular key across the three maps, so they should be one map. In addition to making it impossible for multiple entries to exist, this should improve memory usage since now only one map is allocated on the stack and heap. r? `@GuillaumeGomez`
2021-11-08Go back to loading all external crates unconditionallyJoshua Nelson-1/+2
This *continues* to cause regressions. This code will be unnecessary once access to the resolver happens fully before creating the tyctxt (#83761), so load all crates unconditionally for now.
2021-11-08Use `has_errors_or_lint_errors` in rustdoc instead of `abort_if_errors()`Joshua Nelson-1/+1
Rustdoc is special as usual and doesn't go through RunCompiler, so it needs its own explicit checks. The rest of the tools go through RunCompiler, so they should be fine.
2021-10-31rustdoc: Add `DocVisitor`Noah Lev-0/+1
`DocFolder` allows transforming the docs, accomplished by making its methods take and return types by-value. However, several of the rustdoc `DocFolder` impls only *visit* the docs; they don't change anything. Passing around types by-value is thus unnecessary, confusing, and potentially inefficient for those impls. `DocVisitor` is very similar to `DocFolder`, except that its methods take shared references and return nothing (i.e., the unit type). This should both be more efficient and make the code clearer. There is an additional reason to add `DocVisitor`, too. As part of my cleanup of `external_traits`, I'm planning to add a `fn cache(&mut self) -> &mut Cache` method to `DocFolder` so that `external_traits` can be retrieved explicitly from the `Cache`, rather than implicitly via `Crate.external_traits` (which is an `Rc<RefCell<...>>`). However, some of the `DocFolder` impls that could be turned into `DocVisitor` impls only have a shared reference to the `Cache`, because they are used during rendering. (They have to access the `Cache` via `html::render::Context.shared.cache`, which involves an `Rc`.) Since `DocVisitor` does not mutate any of the types it's visiting, its equivalent `cache()` method will only need a shared reference to the `Cache`, avoiding the problem described above.
2021-10-31Reduce rightward driftNoah Lev-0/+1
2021-10-30Remove unnecessary `macro_use`s in rustdocJoshua Nelson-5/+2
2021-10-25Fix clippy lints in librustdocGuillaume Gomez-1/+1
2021-10-23Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-0/+32
Scrape code examples from examples/ directory for Rustdoc Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123 Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525 Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-07Revert "Stabilize `Iterator::intersperse()`"Jane Lusby-0/+1
2021-10-06Add target crates as inputs to reduce size of intermediatesWill Crichton-6/+14
Add tests for module-path remapping and scrape example options Find all crates with a given name
2021-10-06Incorporate jyn's feedbackWill Crichton-2/+18
* Move call location logic from function constructor to rendering * Fix issue with macro spans in scraping examples * Clean up example loading logic Documentation / newtype for DecorationInfo Fix line number display Serialize edition of call site, other small cleanup
2021-10-06Generate example source files with corresponding linksWill Crichton-8/+10
Add display name Fix remaining merge conflicts Only embed code for items containing examples
2021-10-06Factor scraping and rendering into separate calls to rustdocWill Crichton-16/+10
Simplify toggle UI logic, add workspace root for URLs
2021-10-06Fix check issueWill Crichton-1/+1
Clean up tidy checks
2021-10-06Add updated support for example-analyzerWill Crichton-1/+13
Move rendering of examples into Finalize design Cleanup, rename found -> scraped Softer yellow Clean up dead code Document scrape_examples More simplification and documentation Remove extra css Test
2021-09-29Remove lazy_static dependencyGuillaume Gomez-2/+0
2021-09-21Revert the rustdoc box syntax removalest31-0/+1
It turned out to cause (minor) perf regressions.
2021-09-14Rename --display-warnings to --display-doctest-warningsGuillaume Gomez-2/+6
2021-09-07Rename rustc_mir to rustc_const_eval.Camille GILLOT-1/+1
2021-09-02rustdoc: Higher-ranked lifetimes can't have boundsNoah Lev-0/+1
This cleans up the other spot I found where rustdoc was rendering bounds into the lifetime name itself. However, in this case, I don't think it could have actually happened because higher-ranked lifetime definitions aren't currently allowed to have bounds.
2021-08-31Stabilize `Iterator::intersperse()`inquisitivecrystal-1/+0
2021-08-29Rollup merge of #88173 - camelid:refactor-markdown-length-limit, ↵Guillaume Gomez-0/+1
r=GuillaumeGomez Refactor Markdown length-limited summary implementation This PR is a new approach to #79749. This PR refactors the implementation of `markdown_summary_with_limit()`, separating the logic of determining when the limit has been reached from the actual rendering process. The main advantage of the new approach is that it guarantees that all HTML tags are closed, whereas the previous implementation could generate tags that were never closed. It also ensures that no empty tags are generated (e.g., `<em></em>`). The new implementation consists of a general-purpose struct `HtmlWithLimit` that manages the length-limiting logic and a function `markdown_summary_with_limit()` that renders Markdown to HTML using the struct. r? `@GuillaumeGomez`
2021-08-26Rollup merge of #88215 - jyn514:lazy-loading, r=petrochenkovManish Goregaokar-2/+2
Reland #83738: "rustdoc: Don't load all extern crates unconditionally" I hopefully found all the bugs :crossed_fingers: time for a take two. See the last commit for details on what went wrong before. r? `@petrochenkov` (but feel free to reassign to Guillaume if you don't have time.) Closes https://github.com/rust-lang/rust/issues/68427. Includes a fix for https://github.com/rust-lang/rust/issues/84738.
2021-08-24Stabilize `force-warn`inquisitivecrystal-1/+1
2021-08-24Tidy up lint command line flagsinquisitivecrystal-12/+5