about summary refs log tree commit diff
path: root/src/librustdoc/core.rs
AgeCommit message (Collapse)AuthorLines
2021-09-29Remove lazy_static dependencyGuillaume Gomez-3/+3
2021-09-22Auto merge of #89134 - est31:revert_rustdoc_box_syntax, r=GuillaumeGomezbors-1/+1
Revert the rustdoc box syntax removal Reverts the rustdoc box syntax removal from #87781. It turned out to cause (minor) perf regressions. Requested in https://github.com/rust-lang/rust/pull/87781#issuecomment-922589168
2021-09-21Revert the rustdoc box syntax removalest31-1/+1
It turned out to cause (minor) perf regressions.
2021-09-19Auto merge of #88703 - cjgillot:lazymod, r=petrochenkovbors-6/+2
Gather module items after lowering. This avoids having a non-local analysis inside lowering. By implementing `hir_module_items` using a visitor, we make sure that iterations and visitors are consistent.
2021-09-14Rename --display-warnings to --display-doctest-warningsGuillaume Gomez-2/+1
2021-09-12Gather module items after lowering.Camille GILLOT-6/+2
2021-08-26Rollup merge of #88215 - jyn514:lazy-loading, r=petrochenkovManish Goregaokar-34/+5
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-26Fix the bugs and add a regression testJoshua Nelson-5/+1
- All attributes for an item need to be considered at once, they can't be considered a line at a time. - The top-level crate was not being visited. This bug was caught by `extern-crate-used-only-in-link`, which I'm very glad I added. - Make the loader private to the module, so that only one function is exposed.
2021-08-22Revert "Revert "Don't load all extern crates unconditionally""Joshua Nelson-34/+9
This reverts commit 5f0c54db4e595a6a77048f2b0605138ffa49a326.
2021-08-19Give precedence to `html_root_url` over `--extern-html-root-url` by default, ↵Joshua Nelson-3/+1
but add a way to opt-in to the previous behavior ## What is an HTML root url? It tells rustdoc where it should link when documentation for a crate is not available locally; for example, when a crate is a dependency of a crate documented with `cargo doc --no-deps`. ## What is the difference between `html_root_url` and `--extern-html-root-url`? Both of these tell rustdoc what the HTML root should be set to. `doc(html_root_url)` is set by the crate author, while `--extern-html-root-url` is set by the person documenting the crate. These are often different. For example, docs.rs uses `--extern-html-root-url https://docs.rs/crate-name/version` to ensure all crates have documentation, even if `html_root_url` is not set. Conversely, crates such as Rocket set `doc(html_root_url = "https://api.rocket.rs")`, because they prefer users to view the documentation on their own site. Crates also set `html_root_url` to ensure they have documentation when building locally when offline. This is unfortunate to require, because it's more work from the library author. It also makes it impossible to distinguish between crates that want to be viewed on a different site (e.g. Rocket) and crates that just want documentation to be visible offline at all (e.g. Tokio). I have authored a separate change to the API guidelines to no longer recommend doing this: https://github.com/rust-lang/api-guidelines/pull/230. ## Why change the default? In the past, docs.rs has been the main user of `--extern-html-root-url`. However, it's useful for other projects as well. In particular, Cargo wants to pass it by default when running `--no-deps` (https://github.com/rust-lang/cargo/issues/8296). Unfortunately, for these other use cases, the priority order is inverted. They want to give *precedence* to the URL the crate picks, and only fall back to the `--extern-html-root` if no `html_root_url` is present. That allows passing `--extern-html-root` unconditionally, without having to parse the source code to see what attributes are present. For docs.rs, however, we still want to keep the old behavior, so that all links on docs.rs stay on the site.
2021-08-18remove box_syntax uses from cranelift and toolsMarcel Hellwig-1/+1
2021-07-31rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tablesVadim Petrochenkov-8/+1
and passes using them - primarily privacy checking, stability checking and dead code checking. WIP
2021-07-05Revert "rustdoc: Store DefId's in ItemId on heap for decreasing Item's size"Justus K-3/+3
This reverts commit 41a345d4c46dad1a98c9993bc78513415994e8ba.
2021-07-05rustdoc: Store DefId's in ItemId on heap for decreasing Item's sizeJustus K-3/+3
2021-07-05rustdoc: Replace `FakeDefId` with new `ItemId` typeJustus K-5/+6
2021-07-01Revert "Don't load all extern crates unconditionally"Guillaume Gomez-9/+34
2021-06-30Move AST crate.Camille GILLOT-3/+2
2021-06-05Rollup merge of #85501 - jyn514:invalid-doc-attrs, r=varkorGuillaume Gomez-1/+2
Fix `deny(invalid_doc_attributes)` Fixes https://github.com/rust-lang/rust/issues/85497.
2021-06-04Fix `deny(invalid_doc_attributes)`Joshua Nelson-1/+2
2021-06-04rustdoc: link consistently to stable/beta in diagnostic messagesJoshua Nelson-3/+6
2021-05-17Auto merge of #85178 - cjgillot:local-crate, r=oli-obkbors-3/+3
Remove CrateNum parameter for queries that only work on local crate The pervasive `CrateNum` parameter is a remnant of the multi-crate rustc idea. Using `()` as query key in those cases avoids having to worry about the validity of the query key.
2021-05-15Minimize amount of fake `DefId`s used in rustdocJustus K-3/+3
2021-05-12Use () for all_traits.Camille GILLOT-2/+2
2021-05-12Use () for privacy.Camille GILLOT-1/+1
2021-05-08Auto merge of #84470 - jyn514:lints, r=GuillaumeGomezbors-8/+1
rustdoc: Stop special casing `broken_intra_doc_links` unnecessarily
2021-05-05Revert PR 83866Pietro Albini-6/+3
That PR caused multiple test failures when Rust's channel is changed from nightly to anything else. The commit will have to be landed again after the test suite is fixed.
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-56/+12
2021-04-27Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of ↵Timothée Delabrouille-1/+1
the fields in Attributes, as functions in AttributesExt. refacto use from_def_id_and_attrs_and_parts instead of an old trick most of josha suggestions + check if def_id is not fake before using it in a query Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
2021-04-22rustdoc: Stop special casing `broken_intra_doc_links` unnecessarilyJoshua Nelson-8/+1
2021-04-11Move crate loader to collect_intra_doc_links::earlyJoshua Nelson-50/+3
This groups the similar code together, and also allows making most of collect_intra_doc_links private again
2021-04-10Preprocess intra-doc links consistentlyJoshua Nelson-9/+8
Previously, rustdoc would panic on links to external crates if they were surrounded by backticks.
2021-04-07Reuse logic for determining the channel in the rest of rustdocJoshua Nelson-3/+6
This doesn't update main.js because it's included as a fixed string.
2021-04-04Rollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomezYuki Okushi-4/+3
rustdoc: Rename internal uses of `spotlight` I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-04-02Don't load all extern crates unconditionallyJoshua Nelson-31/+55
Instead, only load the crates that are linked to with intra-doc links. This doesn't help very much with any of rustdoc's fundamental issues with freezing the resolver, but it at least fixes a stable-to-stable regression, and makes the crate loading model somewhat more consistent with rustc's.
2021-04-02rustdoc: Rename internal uses of `spotlight`Camelid-4/+3
I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-03-23Remove unnecessary `Option` wrapping around `Crate.module`Camelid-15/+13
I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-15Add `rustc_interface::interface::Config::parse_sess_created`hyd-dev-0/+1
2021-03-07Rollup merge of #82651 - jyn514:rustdoc-warnings, r=GuillaumeGomezYuki Okushi-27/+36
Cleanup rustdoc warnings ## Clean up error reporting for deprecated passes Using `error!` here goes all the way back to the original commit, https://github.com/rust-lang/rust/pull/8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See https://github.com/rust-lang/rust/pull/81932#issuecomment-785291244 for further context. - Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics ## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!` This also adds a test for the output. This was added in https://github.com/rust-lang/rust/pull/52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in https://github.com/rust-lang/rust/pull/50541.
2021-03-04Remove RefCell around module_trait_cacheJoshua Nelson-2/+2
2021-03-04Don't require a `DocContext` for `report_diagnostic`Joshua Nelson-3/+3
This is needed for the next commit, which needs access to the `cx` from within the `decorate` closure. - Change `as_local_hir_id` to an associated function, since it only needs a `TyCtxt` - Change `source_span_for_markdown_range` to only take a `TyCtxt`
2021-03-04Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomezYuki Okushi-89/+17
Make rustdoc lints a tool lint instead of built-in - Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though). - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests - Move lint machinery into a separate file - Add `declare_rustdoc_lint!` macro Unblocks https://github.com/rust-lang/rust/pull/80300, https://github.com/rust-lang/rust/pull/79816, https://github.com/rust-lang/rust/pull/80965. Makes the strangeness in https://github.com/rust-lang/rust/pull/77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes https://github.com/rust-lang/rust/issues/78786. ## Current status This is blocked on #82620 (see https://github.com/rust-lang/rust/pull/80527#issuecomment-787401519)
2021-03-02Report that `doc(plugins)` doesn't work using diagnostics instead of `println!`Joshua Nelson-4/+2
This also adds a test for the output and fixes `rustc_attr` to properly know that `plugins` is a valid attribute.
2021-03-02Clean up error reporting for deprecated passesJoshua Nelson-23/+34
- Use spans for deprecated attributes - Use a proper diagnostic for unknown passes, instead of error logging - Add tests for unknown passes - Improve some wording in diagnostics
2021-03-01Address review commentsJoshua Nelson-3/+2
- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly - Update documentation This also takes the opportunity to make the `no-crate-level-doc-lint` test more specific.
2021-03-01Move lint machinery into a separate fileJoshua Nelson-168/+7
2021-03-01Rename rustdoc lints to be a tool lint instead of built-in.Joshua Nelson-27/+117
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` - Ensure that the old lint names still work and give deprecation errors - Register lints even when running doctests Otherwise, all `rustdoc::` lints would be ignored. - Register all existing lints as removed This unfortunately doesn't work with `register_renamed` because tool lints have not yet been registered when rustc is running. For similar reasons, `check_backwards_compat` doesn't work either. Call `register_removed` directly instead. - Fix fallout + Rustdoc lints for compiler/ + Rustdoc lints for library/ Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for `rustdoc::intra_doc_link_resolution_failure`, since there was no time when the latter was valid.
2021-03-02Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514Guillaume Gomez-0/+1
Check stability and feature attributes in rustdoc Fixes #82588. cc `@Nemo157` `@camelid` r? `@jyn514`
2021-03-01Remove unused `RenderInfo` structJoshua Nelson-9/+2
2021-03-01Remove the dummy cache in `DocContext`Joshua Nelson-8/+17
The same information is available everywhere; the only reason the dummy cache was needed is because it waas previously stored in three different places. This consolidates the info a bit so the cache in `DocContext` is used throughout. As a bonus, it means `renderinfo` is used much much less. - Return a `Cache` from `run_global_ctxt`, not `RenderInfo` - Remove the unused `render_info` from `run_renderer` - Remove RefCell around `inlined` - Add intra-doc links
2021-02-28Run some rustc passes in rustdocGuillaume Gomez-0/+1