Folyd
a8ede1248d
Change eslint rules from configuration comments to configuration files
2022-05-07 11:47:30 +08:00
Guillaume Gomez
bcfb95afd3
Rollup merge of #96754 - notriddle:notriddle/impl-dups, r=GuillaumeGomez
...
rustdoc: ensure HTML/JS side implementors don't have dups
Fixes #94641
Rendered:
- https://notriddle.com/notriddle-rustdoc-test/impl-dups/std/iter/trait.Iterator.html
- https://notriddle.com/notriddle-rustdoc-test/impl-dups/core/iter/trait.Iterator.html
2022-05-06 20:05:43 +02:00
Guillaume Gomez
93b86d69b6
Rollup merge of #96748 - GuillaumeGomez:reexports-in-search, r=notriddle
...
Fixes reexports in search
Fixes #96681 .
At some point we stopped reexporting items in search so this PR fixes it.
It also adds a regression test.
r? ```@notriddle```
2022-05-06 20:05:41 +02:00
Guillaume Gomez
fcb0bce25c
Rollup merge of #96590 - notriddle:notriddle/tab-bar-fn-search, r=GuillaumeGomez,jsha
...
rustdoc: when running a function-signature search, tweak the tab bar
# Before

# After

2022-05-06 20:05:38 +02:00
Guillaume Gomez
279dee5374
Fix reexports missing from the search index
2022-05-06 13:52:21 +02:00
Michael Goulet
7cdad77536
Rollup merge of #96741 - GuillaumeGomez:improve-settings-loading-strategy, r=jsha
...
Improve settings loading strategy
I learned about this thanks to ```@jsha``` who suggested this approach:
It improves the settings loading strategy by loading CSS and JS at the same time to prevent the style to be applied afterwards on slow connections.
r? ```@jsha```
2022-05-05 19:34:25 -07:00
Michael Goulet
292eefe753
Rollup merge of #96704 - GuillaumeGomez:rotation-animation, r=jsha
...
Add rotation animation on settings button when loading
As discussed, I added an animation when the settings JS file is loading (I voluntarily made the timeout at the end of the `settings.js` super long so we can see what the animation looks like):
https://user-images.githubusercontent.com/3050060/166693243-816a08b7-5e39-4142-acd3-686ad9950d8e.mp4
r? ````@jsha````
2022-05-05 19:34:24 -07:00
Michael Howell
20010d7597
rustdoc: ensure HTML/JS side implementors don't have dups
2022-05-05 17:45:33 -07:00
Guillaume Gomez
87b6326d67
Improve settings loading strategy by loading CSS and JS at the same time to prevent the style to be applied afterwards on slow connections
2022-05-05 20:19:40 +02:00
Michael Howell
4c183cd2d4
rustdoc: fix JS error when rendering parse error
2022-05-05 09:39:47 -07:00
Michael Howell
8b2147b497
rustdoc: fix keyboard shortcuts and console log on search page
2022-05-05 09:39:45 -07:00
Michael Howell
21a121332b
rustdoc: change the "In Function Signatures" to context-sensitive
...
* If it's just `-> a`, use "In Function Return Types"
* If it's just `a b`, use "In Function Parameters"
* Otherwise, still use "In Function Signatures"
2022-05-05 09:37:29 -07:00
Michael Howell
6c8a2d4715
rustdoc: when running a function-signature search, tweak the tab bar
2022-05-05 09:37:29 -07:00
Guillaume Gomez
13b45aa6c6
Add rotation animation on settings button when loading
2022-05-05 11:08:15 +02:00
Guillaume Gomez
1e204ddb3b
Use "strict" mode in JS scripts
2022-05-05 11:07:14 +02:00
Folyd
67ebeea7a0
Move callback to the () => {} syntax.
...
Fix lint
Fix main.js
Restore anonymous functions
Fix
Fix more
2022-05-04 11:10:48 +08:00
Yuki Okushi
27d7615bb4
Rollup merge of #93097 - GuillaumeGomez:settings-js, r=jsha
...
Switch settings menu to full js
Since the settings can only be set when the JS is enabled, it's not really a problem. It also fixes a debate we had around the themes not being accessible easily before.

You can test it [here](https://rustdoc.crud.net/imperio/settings-js/doc/foo/index.html ).
r? ``@jsha``
2022-05-03 14:58:56 +09:00
Vadim Petrochenkov
5b5964f569
rustc: Panic by default in DefIdTree::parent
...
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root.
So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root.
Same applies to `local_parent`/`opt_local_parent`.
2022-05-02 01:56:50 +03:00
Guillaume Gomez
73688e4021
* Add documentation for settings page rendering functions.
...
* Improve code.
* Fix some documentation argument types.
* Make settings order the same as before this PR.
* Change timeout to 0 so that browser will render it as fast as possible.
2022-05-01 21:22:38 +02:00
Camille GILLOT
94449e6101
Store all generic bounds as where predicates.
2022-04-30 13:55:13 +02:00
Guillaume Gomez
9625ed8be7
Move settings into full JS
2022-04-30 13:12:41 +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