Guillaume Gomez
5c7ce84d74
Remove unneeded SpanMapVisitor::visit_generics function
2022-05-06 22:01:30 +02:00
Guillaume Gomez
a26cb6154d
Fix regression in link-to-definition introduced in #93803
2022-05-02 15:06:45 +02:00
Camille GILLOT
94449e6101
Store all generic bounds as where predicates.
2022-04-30 13:55:13 +02:00
Dylan DPC
bfb13ec691
Rollup merge of #96390 - GuillaumeGomez:es6-part2, r=notriddle
...
Switch JS code to ES6 - part 2
Part of #93058 .
It's based on https://github.com/rust-lang/rust/pull/96361 so it needs to wait for it to be merged first.
r? `@notriddle`
2022-04-29 23:54:37 +02:00
Dylan DPC
c0ed53c0da
Rollup merge of #96430 - GuillaumeGomez:search-exclamation, r=notriddle
...
Fix handling of `!` in rustdoc search
Fixes #96399 .
I also updated the eBNF.
cc `@jsha`
r? `@notriddle`
2022-04-27 02:47:12 +02:00
Dylan DPC
875b22ff30
Rollup merge of #96410 - notriddle:notriddle/issue-95873, r=GuillaumeGomez
...
rustdoc: do not write `{{root}}` in `pub use ::foo` docs
Fixes #95873
2022-04-27 02:47:11 +02:00
Guillaume Gomez
4e0be6ddeb
Remove dead code in main.js
2022-04-26 20:59:33 +02:00
Guillaume Gomez
509b145744
Migrate scrape-examples.js to ES6
2022-04-26 20:59:33 +02:00
Guillaume Gomez
724c4bd9bb
Migrate storage.js to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
6faa40d406
Migrate source-script to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
016334a3ad
Migrate main.js to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
cb8da88c83
Migrate externs.js to ES6
2022-04-26 20:59:32 +02:00
Guillaume Gomez
ae93e6e3b8
Small JS code improvements
2022-04-26 20:59:32 +02:00
Guillaume Gomez
45cdb2be10
Update rustdoc search parser to handle ! correctly
2022-04-26 20:57:45 +02:00
Guillaume Gomez
52fefb0454
Rollup merge of #96361 - GuillaumeGomez:es6, r=notriddle
...
Switch JS code to ES6
Considering it's already quite big, I'll do the remaining files in another PR.
Part of #93058 .
r? ``@notriddle``
2022-04-26 13:22:28 +02:00
Dylan DPC
2381897f27
Rollup merge of #96279 - GuillaumeGomez:remove-woff-fonts, r=camelid,jsha
...
rustdoc: Remove .woff font files
Copying `@jsha's` great comment:
> Right now we ship 1.5MB of woff files in the rustdoc binary, and 1MB of woff2 files, for a total of 2.5MB.
>
> Per:
>
> https://caniuse.com/woff
> https://caniuse.com/woff2
>
> The only listed browser that supports woff and not woff2 is IE, which is not supported per https://github.com/rust-lang/rfcs/blob/master/text/1985-tiered-browser-support.md .
>
> I propose we stop shipping woff files and save 1.5MB from the rustdoc binary (and from each doc build).
r? `@jsha`
2022-04-26 01:21:21 +02:00
Michael Howell
ae38f35720
rustdoc: do not write {{root}} in pub use ::foo docs
2022-04-25 15:38:43 -07:00
Guillaume Gomez
3c95c0bd62
Update settings.js to ES6
2022-04-24 15:36:15 +02:00
Guillaume Gomez
4280c816fa
Update search.js to ES6
2022-04-24 15:36:02 +02:00
bors
de1bc0008b
Auto merge of #96260 - Kobzol:rustdoc-idmap, r=petrochenkov
...
rustdoc: Optimize IdMap
Slightly optimizes `IdMap`, which is hot in `markdown_links` (context [here](https://github.com/rust-lang/rust/pull/96135#issuecomment-1103539052 )). There are more improvements that can be made near this place, but this seemed like an easy win locally (although I tried it on top of https://github.com/rust-lang/rust/pull/94857 , so let's see what happens without that PR).
r? `@petrochenkov`
2022-04-21 18:31:57 +00:00
Guillaume Gomez
718f93425c
Remove .woff font files
2022-04-21 13:07:21 +02:00
bors
3d3dafb771
Auto merge of #95828 - vacuus:rustdoc-print-where-clause, r=notriddle
...
rustdoc: Clean up `html::format::print_where_clause`
(Arguably) closes https://github.com/rust-lang/rust/issues/95814
2022-04-21 08:12:38 +00:00
bors
7be1da0319
Auto merge of #96263 - Dylan-DPC:rollup-0eofl13, r=Dylan-DPC
...
Rollup of 5 pull requests
Successful merges:
- #90630 (Create real parser for search queries)
- #96193 ([fuchsia] Add implementation for `current_exe`)
- #96196 (Remove assertion that all paths in `ShouldRun` exist)
- #96228 (Fix locations for intrinsics impls and change to links)
- #96236 (Add an explicit `Span` field to `OutlivesConstraint`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-21 02:16:32 +00:00
Roc Yu
5d59c16c2d
rustdoc: Clean up html::format::print_where_clause
2022-04-20 20:45:30 -04:00
Dylan DPC
976c6b2d19
Rollup merge of #90630 - GuillaumeGomez:improve-rustdoc-search, r=notriddle
...
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-21 01:14:13 +02:00
Jakub Beránek
34e2d3bab8
rustdoc: Optimize IdMap
2022-04-21 00:15:04 +02:00
Guillaume Gomez
4d26bde4f0
Extend handleSingleArg documentation
2022-04-20 21:11:39 +02:00
Guillaume Gomez
f988f86cdc
Remove <> links to be potential intra-doc links
2022-04-20 20:28:15 +02:00
bors
d39864d64e
Auto merge of #96135 - petrochenkov:doclink6, r=GuillaumeGomez
...
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-20 13:34:48 +00:00
Dylan DPC
a0ba15bfab
Rollup merge of #95813 - Urgau:rustdoc-where-clause-space, r=GuillaumeGomez
...
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:

After:

r? ``@GuillaumeGomez``
2022-04-19 22:57:40 +02:00
Vadim Petrochenkov
de287df862
rustdoc: Cache preprocessed markdown links
2022-04-19 22:53:50 +03:00
Guillaume Gomez
8d0e10cfbe
Correctly handle single :
2022-04-18 23:11:42 +02:00
Guillaume Gomez
299e8ee25e
Add an extra check over filter type
2022-04-18 21:43:19 +02:00
Guillaume Gomez
d7d538a8c4
Fix some corner cases
2022-04-18 20:59:09 +02:00
Guillaume Gomez
6f35475ba5
Parse idents the same way in both quote string elements and "normal" elements
2022-04-18 20:59:09 +02:00
Guillaume Gomez
a6051c76db
Remove unnecessary elem.name.length === 0 since the rustdoc search eBNF does not allow elements without a name
2022-04-18 20:59:09 +02:00
Guillaume Gomez
51b4005003
Update the eBNF to allow generics bracket to not be closed if it's EOF
2022-04-18 20:59:09 +02:00
Guillaume Gomez
e03a950747
Handle separators in their own functions and fix missing handling of tabs
2022-04-18 20:59:09 +02:00
Guillaume Gomez
da829d8d9d
Improve the BNF description a bit and fix some issues
2022-04-18 20:59:09 +02:00
Guillaume Gomez
1f5c4c2b30
Forbid rustdoc search query to end with ->
2022-04-18 20:59:09 +02:00
Guillaume Gomez
8e29ed43d9
Add isIdentCharacter function to ensure that unexpected characters are handled correctly
2022-04-18 20:59:09 +02:00
Guillaume Gomez
f9251eef68
Replace unneeded use of regex with a simple if
2022-04-18 20:59:09 +02:00
Guillaume Gomez
699ae365df
Apply suggestions:
...
* 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-18 20:59:09 +02:00
Guillaume Gomez
c7de1a16f8
Improve documentation and add some explanations in the code
2022-04-18 20:59:09 +02:00
Guillaume Gomez
49297337b4
Simplify parser syntax
2022-04-18 20:59:08 +02:00
Guillaume Gomez
99d552092c
Make query parser more strict and improve display of errors
2022-04-18 20:59:08 +02:00
Guillaume Gomez
264064df36
* Greatly improve the rustdoc search parser source code
...
* Move all functions outside parseQuery
2022-04-18 20:59:08 +02:00
Guillaume Gomez
99c5394ecc
Add query syntax for the parser
2022-04-18 20:59:08 +02:00
Guillaume Gomez
51de26cfd9
* If type filter is in quotes, throw an error.
...
* If there are generics, don't allow to have quotes.
2022-04-18 20:59:08 +02:00
Guillaume Gomez
bbcf1762dd
Improve naming of "val" field
2022-04-18 20:59:08 +02:00