about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-12-27Move `ExternalLocation` to `clean::types`Noah Lev-19/+19
It was previously defined in `render::search_index` but wasn't used at all there. `clean::types` seems like a better fit since that's where `ExternalCrate` is defined.
2021-12-27rustdoc: Remove some unnecessary `cache` parametersNoah Lev-24/+13
Based on https://github.com/rust-lang/rust/pull/80883#issuecomment-774437832. The `tcx` parameters do seem to be used though, so I only removed the `cache` parameters.
2021-12-27Rename `rustdoc::html::render::cache` to `search_index`Noah Lev-6/+6
The old name wasn't very clear, while the new one makes it clear that this is the code responsible for creating the search index.
2021-12-27intra-doc: Use an enum to represent URL fragmentsNoah Lev-78/+113
This is a step in the direction of computing the links more lazily, which I think will simplify the implementation of intra-doc links. This will also make it easier to eventually use the actual `Res` for associated items, enum variants, and fields, rather than their HTML page's `Res`.
2021-12-27Remove needless `return`Noah Lev-1/+1
2021-12-27rustdoc: Preserve rendering of macro_rules matchers when possibleDavid Tolnay-6/+55
2021-12-25Remove unneeded call to `collect`Roc Yu-5/+6
2021-12-25Remove `String` allocation in loopRoc Yu-3/+1
2021-12-25Auto merge of #92262 - notriddle:notriddle/unused-hash, r=jyn514bors-11/+2
rustdoc: remove unused Hash impl
2021-12-25Auto merge of #92227 - Kobzol:rustdoc-doc-hidden, r=jyn514bors-16/+7
Rustdoc: use `is_doc_hidden` method on more places While profiling `rustdoc`, I noticed that finding out if some item is marked with `#[doc(hidden)]` is relatively hot, so I tried to optimize it. I noticed that there is already a method called `is_doc_hidden` on `TyCtxt`, but it wasn't used much, so I replaced the manual calls to `attrs(...).has_word(...)` with this method. Just by doing that, perf. was improved locally, although I'm not sure if the semantics of the previous calls and this method are the same? As another step, I tried to querify `is_doc_hidden`, but I didn't include that here until we see the perf. results from the first commit and until I find whether this change is OK at all :) Can I ask for a perf. run? Thanks. r? `@jyn514`
2021-12-24Auto merge of #92229 - fee1-dead:fix-rustdoc-const-drop, r=dtolnaybors-20/+35
Do not display `~const Drop` in rustdoc Although `T: ~const Drop` is still at an experimental stage, we have already begun inserting these bounds in libstd. This change hides them from rustdoc because 1. `~const` should not be documented in general as it is not yet official syntax; 2. users are not expected to know what `~const Drop` means yet.
2021-12-24rustdoc: remove unused Hash implMichael Howell-11/+2
2021-12-23Clean up NestedAttributesExt trait/implementationRoc Yu-10/+15
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-23Do not display `~const Drop` in rustdocDeadbeef-20/+35
2021-12-23Auto merge of #92177 - GuillaumeGomez:pattern-matching-outside-loop, r=camelidbors-6/+8
Move pattern matching outside of the loop Not sure if worth it but it's been bugging me for a while now. r? `@camelid`
2021-12-23Rustdoc: use `is_doc_hidden` method on more placesJakub Beránek-16/+7
2021-12-23fix rustdoclcnr-11/+17
2021-12-23Auto merge of #92167 - pierwill:chalk-update, r=jackh726bors-2/+2
Update chalk to 0.75.0 - Compute flags in `intern_ty` - Remove `tracing-serde` from `PERMITTED_DEPENDENCIES` - Bump `tracing-tree` to 0.2.0 - Bump `tracing-subscriber` to 0.3.3
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-23Rollup merge of #92146 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-7/+16
Don't emit shared files when scraping examples from dependencies in Rustdoc This PR fixes #91605. The issue is that `Context::init` gets called when scraping dependencies. By default, just calling `init` calls into `write_shared` and `build_index` which register the scraped crate into a list that later gets used for the Rustdoc sidebar. The fix is to ensure that `write_shared` is not called when scraping. r? `@jyn514`
2021-12-22Add some JSDoc comments to rustdoc JSJacob Hoffman-Andrews-30/+170
This follows the Closure Compiler dialect of JSDoc, so we can use it to do some basic type checking. We don't plan to compile with Closure Compiler, just use it to check types. See https://github.com/google/closure-compiler/wiki/ for details.
2021-12-22Upgrade `tracing-subscriber`pierwill-1/+1
2021-12-22Update chalk to 0.75.0pierwill-1/+1
- Compute flags in `intern_ty` - Remove tracing-serde from PERMITTED_DEPENDENCIES - Disable `tracing-full` feature in `chalk-solve` - Bump tracing-tree to 0.2.0
2021-12-21Remove apparently unnecessary conditional in `doc_value`Noah Lev-3/+0
I need to remove this conditional for #91072, but while it seems unnecessary, we are not certain. So, the plan is to first remove the conditional and see if any regressions pop up before doing the refactor. This way, it will be easier to revert if there are subtle regressions.
2021-12-21Move pattern matching outside of the loopGuillaume Gomez-6/+8
2021-12-21Auto merge of #92095 - vacuus:master, r=jyn514bors-29/+22
rustdoc: Remove 'need_backline' field from `DocFragment` Fixes [#92084](https://github.com/rust-lang/rust/issues/92084)
2021-12-20Move duplicates removal when generating results instead of when displaying themGuillaume Gomez-11/+13
2021-12-20Auto merge of #91900 - pitaj:fix-91714, r=jyn514bors-118/+81
rustdoc: make `--passes` and `--no-defaults` have no effect Fixes #91714 One potential issue is that currently there is no stable way to achieve `--document-hidden-items`. This affects test `issue-15347`. I also had to modify the tests `issue-42875` and `no-compiler-export`. Regardless of combinations of `--document-hidden-items` and `--document-private-items`, I was unable to get these to pass without the modifications. I left behind a comment noting the change.
2021-12-19Remove 'need_backline' field of `DocFragment`Roc Yu-29/+18
2021-12-19Omit check of a successive line in loopvacuus-6/+10
I think that s == "" is the only edge case (as it makes iter.next() return None the first time). The early return is necessary so that the last character of 'out' isn't popped if s == "" && !frag.need_backline
2021-12-19Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgrbors-24/+7
Rollup of 7 pull requests Successful merges: - #91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts") - #91984 (Remove `in_band_lifetimes` from `rustc_middle`) - #92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets) - #92042 (Enable `#[thread_local]` for all windows-msvc targets) - #92071 (Update example code for Vec::splice to change the length) - #92077 (rustdoc: Remove unused `collapsed` field) - #92081 (rustdoc: Remove unnecessary `need_backline` function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-19Rollup merge of #92081 - jyn514:need-backline, r=GuillaumeGomezMatthias Krüger-7/+3
rustdoc: Remove unnecessary `need_backline` function r? `@GuillaumeGomez`
2021-12-19Rollup merge of #92077 - jyn514:remove-collapsed, r=GuillaumeGomezMatthias Krüger-17/+4
rustdoc: Remove unused `collapsed` field `render/context` always runs after `run_global_context`, so it was always set to `true`. This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was removed ages ago, and the ability to configure passes is about to be removed. Found while reviewing https://github.com/rust-lang/rust/pull/91305.
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-61/+54
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-19Auto merge of #91871 - camelid:urlpartsbuilder, r=GuillaumeGomezbors-17/+192
rustdoc: Add `UrlPartsBuilder` This is a type for efficiently and easily constructing the part of a URL after the domain: `nightly/core/str/struct.Bytes.html`. It allows simplifying some code and avoiding some allocations in the `href_*` functions. It will also allow making `Cache.paths` et al. use `Symbol` without having to allocate `String`s in the `href_*` functions. `String`s would be necessary otherwise because `Symbol::as_str()` returns `SymbolStr`, whose `Deref<Target = str>` impl requires the `str` to not outlive it. This is the primary motivation for the addition of `UrlPartsBuilder`.
2021-12-19Rollup merge of #92082 - jyn514:remove-from-iterator, r=jyn514Matthias Krüger-12/+16
rustdoc: Write doc-comments directly instead of using FromIterator The FromIterator impl made the code much harder to understand. The types don't make sense until you realize there's a custom FromIterator impl. This is the first commit from https://github.com/rust-lang/rust/pull/91305; since ``@camelid`` wrote it originally I don't feel bad unilaterally approving it. r? ``@ghost`` ``@bors`` r+ Note that this will conflict with https://github.com/rust-lang/rust/pull/92078.
2021-12-18Write code directly instead of using FromIteratorNoah Lev-12/+16
The FromIterator impl made the code much harder to understand. The types don't make sense until you realize there's a custom FromIterator impl.
2021-12-18Remove unnecessary `need_backline` functionJoshua Nelson-7/+3
2021-12-18Remove `collapsed` fieldJoshua Nelson-17/+4
`render/context` always runs after `run_global_context`, so it was always set to `true`. This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was removed ages ago, and the ability to configure passes is about to be removed.
2021-12-18Rollup merge of #92032 - petrochenkov:extblockpath, r=oli-obkMatthias Krüger-6/+6
hir: Do not introduce dummy type names for `extern` blocks in def paths Use a separate nameless `DefPathData` variant instead. Extracted from https://github.com/rust-lang/rust/pull/91795.
2021-12-18Rollup merge of #91977 - GuillaumeGomez:unify-search-code, r=jshaMatthias Krüger-110/+102
Clean up search code and unify function returned values This PR is a cleanup: there is no changes in the search results or in the UI. Depending if it was "literal search" or not, it was either returning booleans or integers. It's pretty bad so instead it all returns integers. Another thing I did was to move the add and checks into a `addIntoResults` function to simplify things. Last thing: I removed a loop in the `sortResults` function and moved its code directly into the first loop. All these changes are done to make #90630 much smaller. r? `@jsha`
2021-12-18hir: Do not introduce dummy type names for `extern` blocks in def pathsVadim Petrochenkov-6/+6
Use a separate nameless `DefPathData` variant instead
2021-12-17Auto merge of #91812 - camelid:assoc-const-lazy, r=GuillaumeGomezbors-20/+31
rustdoc: Pretty-print assoc const defaults on-demand This should improve performance, clean up the code, and help pave the way for #83035.
2021-12-16Auto merge of #92003 - matthiaskrgr:rollup-obgv0rt, r=matthiaskrgrbors-0/+30
Rollup of 7 pull requests Successful merges: - #91172 (Warn when a `#[test]`-like built-in attribute macro is present multiple times.) - #91796 (Fix since attribute for const_manually_drop feature) - #91879 (Remove `in_band_lifetimes` from `rustc_borrowck`) - #91947 (Add `io::Error::other`) - #91967 (Pull in libdevstat on FreeBSD) - #91987 (Add module documentation for rustdoc passes) - #92001 (Fix default_method_body_is_const when used across crates) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-16Make loop more clear by renaming variablesGuillaume Gomez-4/+8
2021-12-16Clean up search code and unify function returned valuesGuillaume Gomez-108/+96
2021-12-16Rollup merge of #91987 - jsha:docdocgoose, r=jyn514Matthias Krüger-0/+30
Add module documentation for rustdoc passes These are currently documented at https://rustc-dev-guide.rust-lang.org/rustdoc-internals.html#hot-potato but can easily go out of date. We'd like to document them in place and link to https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/passes/index.html [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/moving.20pass.20docs/near/265058351). r? `@camelid`
2021-12-16Auto merge of #91833 - klensy:rd-minus-alloc, r=jyn514bors-11/+6
rustdoc: don't clone already owned `Path` and modify it inplace
2021-12-16Rollup merge of #91958 - jsha:rust-logo, r=GuillaumeGomezMatthias Krüger-18/+14
Apply rust-logo class only on default logo Fixes #91653. ![image](https://user-images.githubusercontent.com/220205/146138145-a7a62ea6-3205-4bc7-8460-e985284d93ea.png) Demo: https://rustdoc.crud.net/jsha/hashes/sha2/ r? ``@GuillaumeGomez``