Dylan DPC
0b96be79de
Rollup merge of #96536 - rust-lang:notriddle/deref-slice-core, r=GuillaumeGomez
...
rustdoc: fix missing method list for primitive deref target
This change makes it so that local impls count when listing primitives that need retained.
Fixes #95325
2022-04-29 23:54:40 +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
Michael Howell
8743ce8523
rustdoc: prevent B -> C -> B -> C loops from stack overflowing
2022-04-29 09:06:50 -07:00
Michael Howell
346065f621
rustdoc: fix missing method list for primitive deref target
...
This change makes it so that local impls count when listing primitives that
need retained.
2022-04-28 16:45:05 -07:00
Vadim Petrochenkov
2733ec1be3
rustc_ast: Harmonize delimiter naming with proc_macro::Delimiter
2022-04-28 10:04:29 +03:00
bors
0e7915d11f
Auto merge of #96085 - jsgf:deny-unused-deps, r=compiler-errors
...
Make sure `-Dunused-crate-dependencies --json unused-externs` makes rustc exit with error status
This PR:
- fixes compiletest to understand unused extern notifications
- adds tests for `--json unused-externs`
- makes sure that deny-level unused externs notifications are treated as compile errors
- refactors the `emit_unused_externs` callstack to plumb through the level as an enum as a string, and adds `Level::is_error`
Update: adds `--json unused-externs-silent` with the original behaviour since Cargo needs it. Should address `@est31's` concerns.
Fixes: https://github.com/rust-lang/rust/issues/96068
2022-04-28 04:17:52 +00:00
Dylan DPC
4c628bbb1c
Rollup merge of #96471 - BoxyUwU:let_else_considered_harmful, r=lcnr
...
replace let else with `?`
r? `@oli-obk`
2022-04-28 02:40:36 +02:00
Jeremy Fitzhardinge
c6bafa7322
Add --json unused-externs-silent with original behaviour
...
Since Cargo wants to do its own fatal error handling for unused
dependencies, add the option `--json unused-externs-silent` which
has the original behaviour of not indicating non-zero exit status for
`deny`/`forbid`-level unused dependencies.
2022-04-27 10:04:25 -07:00
Ellen
f697955c1e
tut tut tut
2022-04-27 08:51:33 +01: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
5ffebc2cb3
Auto merge of #96301 - notriddle:notriddle/synthetic-impl-prim, r=GuillaumeGomez
...
rustdoc: make primitive synthetic impls for correct doc module
This improves the accuracy of libcore primitive docs, which was missing the blanket and auto impls for most primitive types. To test this, compare nightly [libcore::str] docs, which lack auto traits like Send, with [std::str] docs, which show them.
[libcore::str]: https://doc.rust-lang.org/nightly/core/primitive.str.html
[libstd::str]: https://doc.rust-lang.org/nightly/std/primitive.str.html
It also avoids getting synthetic impls for primitive types on crates that do not actually show them.
<details>
<summary>Before and After trace logs</summary>
## Before
[notriddle@deep-thought test-dingus]$ RUSTDOC_LOG=rustdoc=trace rustdoc +nightly test.rs 2>&1 | grep -E 'get_blanket_impls\('
TRACE rustdoc::clean::blanket_impl get_blanket_impls(Whatever)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(isize)
TRACE rustdoc::clean::blanket_impl get_blanket_impls([T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([u8])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([u8])
TRACE rustdoc::clean::blanket_impl get_blanket_impls(char)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u128)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u16)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i128)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i16)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(str)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(str)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u8)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i8)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*const T)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*mut T)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*const [T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*mut [T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([T; N])
TRACE rustdoc::clean::blanket_impl get_blanket_impls(bool)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f32)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f32)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u32)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(usize)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i32)
## After
[notriddle@deep-thought test-dingus]$ RUSTDOC_LOG=rustdoc=trace rustdoc +dev test.rs 2>&1 | grep -E 'get_blanket_impls\('
TRACE rustdoc::clean::blanket_impl get_blanket_impls(Whatever)
</details>
2022-04-22 16:47:13 +00:00
bors
8b2393086f
Auto merge of #96282 - petrochenkov:unindent, r=GuillaumeGomez
...
rustdoc: Unindent doc fragments on `Attributes` construction
`Attributes` can be constructed at arbitrary points, even after the `unindent_comments` pass.
`Attributes` that are constructed too late end up unindented.
All doc fragments need to be eventually indented before use, so there are no reasons to not do this immediately during their construction.
Fixes https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60unindent_comments.60.20cannot.20work.20as.20a.20separate.20pass .
I'm not sure how to make a minimized reproduction, but unindenting the fragments during their construction should fix the issue.. by construction, and I also verified that all doc strings now hit the `resolver_caches.markdown_links` cache in https://github.com/rust-lang/rust/pull/94857 .
2022-04-22 02:30:27 +00:00
Michael Howell
2e7b5abbfd
rustdoc: make primitive synthetic impls for correct doc module
...
This improves the accuracy of libcore primitive docs, which was missing the
blanket and auto impls for most primitive types. To test this, compare nightly
[libcore::str] docs, which lack auto traits like Send, with [std::str] docs,
which show them.
[libcore::str]: https://doc.rust-lang.org/nightly/core/primitive.str.html
[libstd::str]: https://doc.rust-lang.org/nightly/std/primitive.str.html
It also avoids getting synthetic impls for primitive types on crates that
do not actually show them.
<details>
<summary>Before and After trace logs</summary>
Before:
[notriddle@deep-thought test-dingus]$ RUSTDOC_LOG=rustdoc=trace rustdoc +nightly test.rs 2>&1 | grep -E 'get_blanket_impls\('
TRACE rustdoc::clean::blanket_impl get_blanket_impls(Whatever)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(isize)
TRACE rustdoc::clean::blanket_impl get_blanket_impls([T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([u8])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([u8])
TRACE rustdoc::clean::blanket_impl get_blanket_impls(char)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u128)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u16)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i128)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i16)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(str)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(str)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u8)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i64)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i8)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*const T)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*mut T)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*const [T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls(*mut [T])
TRACE rustdoc::clean::blanket_impl get_blanket_impls([T; N])
TRACE rustdoc::clean::blanket_impl get_blanket_impls(bool)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f32)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(f32)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(u32)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(usize)
TRACE rustdoc::clean::blanket_impl get_blanket_impls(i32)
After:
[notriddle@deep-thought test-dingus]$ RUSTDOC_LOG=rustdoc=trace rustdoc +dev test.rs 2>&1 | grep -E 'get_blanket_impls\('
TRACE rustdoc::clean::blanket_impl get_blanket_impls(Whatever)
</details>
2022-04-21 17:06:33 -07:00
bors
0b3404b01b
Auto merge of #96261 - petrochenkov:doclink7, r=GuillaumeGomez
...
rustdoc: Resolve some more doc links early
Trying another subset of https://github.com/rust-lang/rust/pull/94857 that is not too expensive.
2022-04-22 00:05:17 +00: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
Vadim Petrochenkov
7803a41151
rustdoc: Unindent doc fragments on Attributes construction
2022-04-21 16:13:02 +03: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
Vadim Petrochenkov
e0b71fff2a
[WIP] rustdoc: Resolve some more doc links early
2022-04-21 01:18:02 +03: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
5cce8cb4ec
rustdoc: Sligthly optimize Attributes construction and processing before doc link resolution
2022-04-19 22:53:50 +03:00
Vadim Petrochenkov
de287df862
rustdoc: Cache preprocessed markdown links
2022-04-19 22:53:50 +03:00
Vadim Petrochenkov
72ed101428
rustdoc: Optimize and refactor doc link resolution
...
- Cache doc link resolutions obtained early
- Cache markdown links retrieved from doc strings early
- Rename and restructure the code in early doc link resolution to be closer to #94857
2022-04-19 22:53:50 +03:00
Dylan DPC
9fad214593
Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkov
...
Stop using CRATE_DEF_INDEX outside of metadata encoding.
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want. We should not manipulate raw `DefIndex` outside of metadata encoding.
2022-04-19 14:43:21 +02: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