about summary refs log tree commit diff
path: root/src/librustdoc/core.rs
AgeCommit message (Collapse)AuthorLines
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
2021-02-23Improve code readabilityGuillaume Gomez-2/+5
2021-02-23Put clean::Trait extra information into a new struct to make it more coherentGuillaume Gomez-1/+1
2021-02-23Remove is_spotlight field from `Trait`Guillaume Gomez-1/+1
2021-02-22Remove many RefCells from DocContextCamelid-15/+20
I left some of them so this change doesn't balloon in size and because removing the RefCell in `DocContext.resolver` would require compiler changes. Thanks to `@jyn514` for making this a lot easier with #82020!
2021-02-22Rollup merge of #82382 - camelid:remove-fake_def_ids-refcell, r=jyn514Yuki Okushi-6/+4
rustdoc: Remove `fake_def_ids` RefCell
2021-02-21rustdoc: Remove `fake_def_ids` RefCellCamelid-6/+4
2021-02-20rustdoc: Remove unnecessary `Cell` around `param_env`Camelid-8/+5
2021-02-19Show negative implementation of Sized traitGuillaume Gomez-0/+11
2021-02-19Auto merge of #82020 - jyn514:mut-passes, r=camelid,GuillaumeGomezbors-13/+13
Make `Clean` take &mut DocContext - Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics` - Take `&mut DocContext` in most of `clean` - Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad. This combined with https://github.com/rust-lang/rust/pull/82018 should hopefully help with https://github.com/rust-lang/rust/pull/82014 by allowing `cx.cache.exported_traits` to be modified in `register_res`. Previously it had to use interior mutability, which required either adding a RefCell to `cache.exported_traits` on *top* of the existing `RefCell<Cache>` or mixing reads and writes between `cx.exported_traits` and `cx.cache.exported_traits`. I don't currently have that working but I expect it to be reasonably easy to add after this.
2021-02-17avoid converting types into themselves (clippy::useless_conversion)Matthias Krüger-1/+1
2021-02-16Make `Clean` take &mut DocContextJoshua Nelson-12/+12
- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics` - Take `&mut DocContext` in most of `clean` - Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad. - Changes `fn sess` to properly return a borrow with the lifetime of `'tcx`, not the mutable borrow.
2021-02-16Take `&mut DocContext` in passesJoshua Nelson-1/+1
This should hopefully allow for less interior mutability.
2021-02-15Index Modules using their LocalDefId.Camille GILLOT-3/+2
2021-02-04Cleanup rustdoc pass descriptions a bitCamelid-1/+1
Also changed a couple of comments from "intra-doc-links" to "intra-doc links" (my understanding is that "intra-doc links" is the standard way to refer to them).
2021-01-30Rollup merge of #81495 - camelid:rustdoc-output_format-optional, ↵Yuki Okushi-1/+1
r=GuillaumeGomez rustdoc: Remove unnecessary optional Previously, the HTML output format was represented by both `Some(OutputFormat::Html)` and `None` so there's no need to have an optional. Instead, `OutputFormat::Html` is explicitly the default and we no longer have a "tri-state enum". r? `````@GuillaumeGomez`````
2021-01-30rustdoc tweakingbors-28/+30
* Reuse memory * simplify `next_def_id`, avoid multiple hashing and unnecessary lookups * remove `all_fake_def_ids`, use the global map instead (probably not a good step toward parallelization, though...) * convert `add_deref_target` to iterative implementation * use `ArrayVec` where we know the max number of elements * minor touchups here and there * avoid building temporary vectors that get appended to other vectors At most places I may or may not be doing the compiler's job is this PR.
2021-01-28rustdoc: Remove unnecessary optionalCamelid-1/+1
Previously, the HTML output format was represented by both `Some(OutputFormat::Html)` and `None` so there's no need to have an optional. Instead, `OutputFormat::Html` is explicitly the default and we no longer have a "tri-state enum".
2021-01-27Remove CACHE_KEY globalGuillaume Gomez-2/+6
2021-01-08Rollup merge of #80372 - jyn514:fix-panics, r=ManishearthYuki Okushi-5/+4
Don't panic when an external crate can't be resolved This isn't actually a bug, it can occur when rustdoc tries to resolve a crate that isn't used in the main code. Fixes #72381. r? `@kinnison` if you have time, otherwise `@Manishearth`
2021-01-05Apply suggestions from code reviewCamelid-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-01-05rustdoc: Turn `next_def_id` comments into docsCamelid-8/+14
2021-01-02Remove unused collapse passGuillaume Gomez-0/+3
2021-01-02End of rework of Attributes structGuillaume Gomez-1/+1
2020-12-25Don't panic when an external crate can't be resolvedJoshua Nelson-5/+4
This isn't actually a bug, it can occur when rustdoc tries to resolve a crate that isn't used in the main code.
2020-12-17Fix error with `--cfg parallel_compiler`Joshua Nelson-1/+1
Apparently expansion() really does return Rc, not Lrc
2020-12-17Move `run_renderer` into the main `global_ctxt` closureJoshua Nelson-46/+3
2020-12-17Separate `create_resolver` into a new functionJoshua Nelson-36/+43
2020-12-17Split apart create_config and run_coreJoshua Nelson-21/+25
2020-12-09Auto merge of #79575 - jyn514:time-passes, r=Mark-Simulacrumbors-3/+1
Don't time `emit_ignored_resolution_errors` This printed several hundred lines each time rustdoc was run, almost all of which rounded to 0.000. Since this isn't useful info, don't print it everywhere, so other perf info is easier to read. r? `@Mark-Simulacrum`
2020-12-04Rollup merge of #79646 - petrochenkov:inclean, r=davidtwcoDylan DPC-1/+0
rustc_metadata: Remove some dead code Follow up to https://github.com/rust-lang/rust/pull/74967
2020-12-03rustc_metadata: Remove some dead codeVadim Petrochenkov-1/+0
2020-12-01Fix `unknown-crate` when using self-profile with rustdocJoshua Nelson-1/+1
... by removing a duplicate `crate_name` field in `interface::Config`, making it clear that rustdoc should be passing it to `config::Options` instead.
2020-11-30Don't time `emit_ignored_resolution_errors`Joshua Nelson-3/+1
This printed several hundred lines each time rustdoc was run, almost all of which rounded to 0.000. Since this isn't useful info, don't print it everywhere, so other perf info is easier to read.
2020-11-24Track `ParamEnv`s properlyJoshua Nelson-2/+14
This uses the same `with_param_env` pattern that late lints use. Thanks to all the doctree refactors, this was very easy to add.
2020-11-22Get rid of `doctree::Impl`Joshua Nelson-16/+0