about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-04-20rustdoc: Clean up `html::format::print_where_clause`Roc Yu-70/+62
2022-04-21Rollup merge of #90630 - GuillaumeGomez:improve-rustdoc-search, r=notriddleDylan DPC-425/+1010
Create real parser for search queries You can test it [here](https://rustdoc.crud.net/imperio/improve-rustdoc-search/std/index.html). This PR adds a real parser for the query engine in rustdoc. The parser is quite simple but it allows to makes query handling much easier. I added a new testsuite to ensure it works as expected and ran fuzzing checks on it for a few hours without problems. So about the parser: as you can see in the screenshot, it handles recursive generics parsing. It also allows to set which item should use exact matching by adding double-quotes around it (look for `exact_search` in the screenshot). Now about the query engine itself: I simplified it a lot thanks to the parsed query. It behaves mostly the same when there is only one argument, but is much more powerful when there are more than one. When making this change, we also removed the support for multi-query. PS: A big part of the PR is tests and test-related code. :) r? `@camelid`
2022-04-21rustdoc: Optimize IdMapJakub Beránek-44/+48
2022-04-20Extend `handleSingleArg` documentationGuillaume Gomez-0/+4
2022-04-20Remove `<>` links to be potential intra-doc linksGuillaume Gomez-1/+13
2022-04-20Auto merge of #96135 - petrochenkov:doclink6, r=GuillaumeGomezbors-4/+6
rustdoc: Optimize and refactor doc link resolution One more subset of https://github.com/rust-lang/rust/pull/94857 that should bring perf improvements rather than regressions + a couple more optimizations on top of it. It's better to read individual commits and their descriptions to understand the changes. The `may_have_doc_links` optimization is not *very* useful here, but it's much more important for https://github.com/rust-lang/rust/pull/94857. Closes https://github.com/rust-lang/rust/issues/96079
2022-04-19Rollup merge of #95813 - Urgau:rustdoc-where-clause-space, r=GuillaumeGomezDylan DPC-1/+2
Remove extra space before a where clause Remove extra space before where clause in the generated documentation. The fix is to move the space before the break-line so that it doesn't appear visually but is still here. Removing it completely would create things like this `impl<D> Delta<D>where D: MyTrait` (missing a space before the where) which I don't think we want. Added two regression test, first one test that the `<br>` is after the space and the second check that the `<br>` is before the spaces. Before: ![image](https://user-images.githubusercontent.com/3616612/162475212-d4bb6727-ed66-4a55-a4a2-4f55189bf8bd.png) After: ![image](https://user-images.githubusercontent.com/3616612/162475467-508fd082-60a7-4a8c-b693-8b188e8843e6.png) r? ``@GuillaumeGomez``
2022-04-19rustdoc: Cache preprocessed markdown linksVadim Petrochenkov-4/+6
2022-04-18Correctly handle single `:`Guillaume Gomez-10/+6
2022-04-18Add an extra check over filter typeGuillaume Gomez-3/+30
2022-04-18Fix some corner casesGuillaume Gomez-5/+3
2022-04-18Parse idents the same way in both quote string elements and "normal" elementsGuillaume Gomez-32/+44
2022-04-18Remove unnecessary `elem.name.length === 0` since the rustdoc search eBNF ↵Guillaume Gomez-1/+1
does not allow elements without a name
2022-04-18Update the eBNF to allow generics bracket to not be closed if it's EOFGuillaume Gomez-1/+1
2022-04-18Handle separators in their own functions and fix missing handling of tabsGuillaume Gomez-3/+18
2022-04-18Improve the BNF description a bit and fix some issuesGuillaume Gomez-18/+44
2022-04-18Forbid rustdoc search query to end with ->Guillaume Gomez-0/+3
2022-04-18Add isIdentCharacter function to ensure that unexpected characters are ↵Guillaume Gomez-10/+29
handled correctly
2022-04-18Replace unneeded use of regex with a simple ifGuillaume Gomez-1/+4
2022-04-18Apply suggestions:Guillaume Gomez-37/+74
* Forbid generics without a path (so "<p>" is forbidden). * Change `handleSingleArg` so that it takes `results_others`, `results_in_args` and `results_returned` as arguments instead of using the "global" variables. * Change `createQueryElement` so that it returns the newly created element instead of taking `elems` as argument. * Improve documentation
2022-04-18Improve documentation and add some explanations in the codeGuillaume Gomez-9/+23
2022-04-18Simplify parser syntaxGuillaume Gomez-41/+39
2022-04-18Make query parser more strict and improve display of errorsGuillaume Gomez-51/+64
2022-04-18* Greatly improve the rustdoc search parser source codeGuillaume Gomez-398/+497
* Move all functions outside parseQuery
2022-04-18Add query syntax for the parserGuillaume Gomez-12/+71
2022-04-18* If type filter is in quotes, throw an error.Guillaume Gomez-3/+11
* If there are generics, don't allow to have quotes.
2022-04-18Improve naming of "val" fieldGuillaume Gomez-32/+32
2022-04-18Update search engine and parser to error when quotes are used on queries ↵Guillaume Gomez-58/+104
with more than one element.
2022-04-18Greatly improve rustdoc searchGuillaume Gomez-394/+602
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-3/+2
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-17Remove extra space before a where clause in the documentationLoïc BRANSTETT-1/+2
2022-04-16Rollup merge of #96118 - GuillaumeGomez:cleanup-def-id-item-id, r=notriddleDylan DPC-39/+39
rustdoc: Rename `def_id` into `item_id` when the type is `ItemId` for readability As `@notriddle` mentioned in https://github.com/rust-lang/rust/pull/96091, the field name is inaccurate. This PR fixes it by renaming it accordingly to its real type. r? `@notriddle`
2022-04-16Rename `def_id` into `item_id` when the type is `ItemId` for readabilityGuillaume Gomez-39/+39
2022-04-15Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r=pnkfelixDylan DPC-2/+5
remove find_use_placement A more robust solution to finding where to place use suggestions was added in #94584. The algorithm uses the AST to find the span for the suggestion so we pass this span down to the HIR during lowering and use it instead of calling `find_use_placement` Fixes #94941
2022-04-14Error on `#[rustc_deprecated]`Jacob Pratt-2/+2
2022-04-13Rollup merge of #93217 - willcrichton:example-analyzer, r=GuillaumeGomezDylan DPC-52/+213
Improve Rustdoc UI for scraped examples with multiline arguments, fix overflow in line numbers This PR improves a few aspects of the scrape examples feature in Rustdoc. * Only function names and not the full call expression are highlighted. * For call-sites with multiline arguments, the minimized code viewer will scroll to the top of the call-site rather than the middle if the argument is larger than the viewer size, ensuring that the function name is visible. * This fixes an issue where the line numbers column had a visible x-scroll bar. r? `@GuillaumeGomez`
2022-04-12Add Rustdoc book link to scrape examples help. Remove remaining panicWill Crichton-3/+9
locations in scrape examples.
2022-04-12rustdoc: discr. required+provided assoc consts+tysLeón Orell Valerian Liehr-168/+262
2022-04-09rustdoc: Reduce allocations in a `html::markdown` functionRoc Yu-7/+5
2022-04-06Switch item-info div to span to generate valid HTMLGuillaume Gomez-3/+7
2022-04-06Rollup merge of #95684 - GuillaumeGomez:fix-item-info-overflow, r=notriddleDylan DPC-1/+1
rustdoc: Fix item info display overflow I came across this issue when reading local `Iterator` docs (reproduced in this screenshot): ![Screenshot from 2022-04-05 17-45-13](https://user-images.githubusercontent.com/3050060/161798150-769ee838-4768-4df8-9d34-b02eb8104eed.png) The problem comes from the fact that `span` isn't `display: block` by default. Since `item-info` was already present on `<div>` in other places, I moved the last one to `div` as well. r? `@notriddle`
2022-04-05Generate a <div> instead of a <span> for item-info elementsGuillaume Gomez-1/+1
2022-04-05Mark scalar layout unions so that backends that do not support partially ↵Oli Scherer-1/+1
initialized scalars can special case them.
2022-04-03Rollup merge of #95613 - GuillaumeGomez:fix-rustdoc-attr-display, r=notriddleDylan DPC-1/+6
Fix rustdoc attribute display Fixes #81482. r? `@notriddle`
2022-04-03Fix display of attributes in rustdocGuillaume Gomez-1/+6
2022-04-02Auto merge of #95568 - GuillaumeGomez:fix-invalid-dom-generation, r=notriddlebors-2/+2
Fix invalid DOM generation Fixes #64371. r? `@notriddle`
2022-04-01Fix invalid DOM generationGuillaume Gomez-2/+2
2022-04-01Rollup merge of #95475 - ↵Matthias Krüger-0/+1
Jules-Bertholet:rustdoc-hide-assoc-consts-from-trait-impls, r=jsha rustdoc: Only show associated consts from inherent impls in sidebar Resolves #95459
2022-03-31remove find_use_placementFausto-2/+5
A more robust solution to finding where to place use suggestions was added. The algorithm uses the AST to find the span for the suggestion so we pass this span down to the HIR during lowering and use it. Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-03-30Remove unneeded `to_string` callGuillaume Gomez-1/+1