about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2022-04-21rustdoc: make primitive synthetic impls for correct doc moduleMichael Howell-4/+9
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-22Auto merge of #96261 - petrochenkov:doclink7, r=GuillaumeGomezbors-7/+20
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-21Auto merge of #96260 - Kobzol:rustdoc-idmap, r=petrochenkovbors-44/+49
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-21rustdoc: Unindent doc fragments on `Attributes` constructionVadim Petrochenkov-131/+89
2022-04-21Remove .woff font filesGuillaume Gomez-85/+30
2022-04-21Auto merge of #95828 - vacuus:rustdoc-print-where-clause, r=notriddlebors-70/+62
rustdoc: Clean up `html::format::print_where_clause` (Arguably) closes https://github.com/rust-lang/rust/issues/95814
2022-04-21Auto merge of #96263 - Dylan-DPC:rollup-0eofl13, r=Dylan-DPCbors-425/+1010
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-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-21[WIP] rustdoc: Resolve some more doc links earlyVadim Petrochenkov-7/+20
2022-04-21rustdoc: Optimize IdMapJakub Beránek-44/+49
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-114/+196
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: Sligthly optimize `Attributes` construction and processing before ↵Vadim Petrochenkov-44/+31
doc link resolution
2022-04-19rustdoc: Cache preprocessed markdown linksVadim Petrochenkov-45/+68
2022-04-19rustdoc: Optimize and refactor doc link resolutionVadim Petrochenkov-40/+112
- 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-19Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkovDylan DPC-24/+14
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-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-17Fix rustdoc duplicated blanket impls issueGuillaume Gomez-4/+39
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-24/+14
`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-120/+121
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-120/+121
2022-04-16Rollup merge of #96059 - euclio:doc-cfg, r=manishearth,guillaumegomezDylan DPC-30/+19
clarify doc(cfg) wording The current "This is supported" wording implies that it's possible to still use the item on other configurations, but in an unsupported way. Changing this to "Available" removes this ambiguity.
2022-04-16Rollup merge of #96023 - matthiaskrgr:clippyper1304, r=lcnrDylan DPC-1/+1
couple of clippy::perf fixes
2022-04-15Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r=pnkfelixDylan DPC-3/+6
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-14clarify doc(cfg) wordingAndy Russell-30/+19
The current "This is supported" wording implies that it's possible to still use the item on other configurations, but in an unsupported way. Changing this to "Available" removes this ambiguity.