about summary refs log tree commit diff
path: root/src/doc/rustdoc
AgeCommit message (Collapse)AuthorLines
2023-09-19Rollup merge of #112725 - notriddle:notriddle/advanced-search, r=GuillaumeGomezGuillaume Gomez-50/+243
rustdoc-search: add support for type parameters r? `@GuillaumeGomez` ## Preview * https://notriddle.com/rustdoc-html-demo-4/advanced-search/rustdoc/read-documentation/search.html * https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=option%3Coption%3CT%3E%3E%20-%3E%20option%3CT%3E * https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=option%3CT%3E,%20E%20-%3E%20result%3CT,%20E%3E * https://notriddle.com/rustdoc-html-demo-4/advanced-search/std/index.html?search=-%3E%20option%3CT%3E ## Description When writing a type-driven search query in rustdoc, specifically one with more than one query element, non-existent types become generic parameters instead of auto-correcting (which is currently only done for single-element queries) or giving no result. You can also force a generic type parameter by writing `generic:T` (and can force it to not use a generic type parameter with something like `struct:T` or whatever, though if this happens it means the thing you're looking for doesn't exist and will give you no results). There is no syntax provided for specifying type constraints for generic type parameters. When you have a generic type parameter in a search query, it will only match up with generic type parameters in the actual function, not concrete types that match, not concrete types that implement a trait. It also strictly matches based on when they're the same or different, so `option<T>, option<U> -> option<U>` matches `Option::and`, but not `Option::or`. Similarly, `option<T>, option<T> -> option<T>` matches `Option::or`, but not `Option::and`. ## Motivation This feature is motivated by the many "combinitor"-type functions found in generic libraries, such as Option, Future, Iterator, and Entry. These highly-generic functions have names that are almost completely arbitrary, and a type signature that tells you what it actually does. This PR is a major step towards[^closure] being able to easily search for generic functions by their type signature instead of by name. Some examples of combinators that can be found using this PR (try them out in the preview): * `option<option<T>> -> option<T>` returns Option::flatten * `option<T> -> result<T>` returns Option::ok_or * `option<result<T>> -> result<option<T>>` returns Option::transpose * `entry<K, V>, FnOnce -> V` returns `Entry::or_insert_with` (and `or_insert_with_key`, since there's no way to specify the generics on FnOnce) [^closure]: For this feature to be as useful as it ought to be, you should be able to search for *trait-associated types* and *closures*. This PR does not implement either of these: they are **Future possibilities**. Trait-associated types would allow queries like `option<T> -> iterator<item=T>` to return `Option::iter`. We should also allow `option<T> -> iterator<T>` to match the associated type version. Closures would make a good way to query for things like `Option::map`. Closure support needs associated types to be represented in the search index, since `FnOnce() -> i32` desugars to `FnOnce<Output=i32, ()>`, so associated trait types should be implemented first. Also, we'd want to expose an easy way to query closures without specifying which of the three traits you want.
2023-09-15Update documentation for `custom_code_classes_in_docs` featureGuillaume Gomez-2/+6
2023-09-15Add support for double quotes in markdown codeblock attributesGuillaume Gomez-0/+11
2023-09-15Add documentation for `custom_code_classes_in_docs` featureGuillaume Gomez-0/+29
2023-09-10Fixed typo in re-exports.mdPhilVoel-1/+1
own't -> won't
2023-09-09rustdoc-doc: add `next_chunk` to list of `vec::intoiter<T> -> [T]`Michael Howell-1/+1
This didn't show up before, because of some unification bugs that were fixed in 269cb579479ab950e85a2e4078810501c29d7465
2023-09-03Update docs since path-based type search works nowMichael Howell-3/+3
2023-09-03rustdoc: write detailed chapter on search engineMichael Howell-50/+243
2023-08-28rustdoc: start new "Sections" section in the book with Aliased TypeUrgau-0/+16
2023-08-21Auto merge of #106561 - GuillaumeGomez:warning-block, r=rustdocbors-0/+13
Add warning block support in rustdoc Fixes https://github.com/rust-lang/rust/issues/79710. You can test it [here](https://rustdoc.crud.net/imperio/warning-block/foo/struct.Foo.html). It currently looks like this: ![image](https://user-images.githubusercontent.com/3050060/211413494-e1cf04e4-c081-4a9d-97db-27329405cfa7.png) So a few things to note: * Since it's a new add and it's changing the UI, we'll need to go through an FCP. * Does the UI looks good? * Is the way picked to add a warning block ok for everyone? The discussion on the issue seemed to be in favour of this solution but it doesn't hurt to double-check. cc `@rust-lang/rustdoc`
2023-08-18Fix resolution cachingKyle Lin-7/+19
2023-08-18Add warn level lint `redundant_explicit_links`Kyle Lin-0/+22
- Currently it will panic due to the resolution's caching issue
2023-08-14Add GUI test for warning blocksGuillaume Gomez-1/+2
2023-08-14Add documentation for warning blocks in rustdoc bookGuillaume Gomez-0/+12
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-07-17Rollup merge of #112741 - geometryolife:fix, r=workingjubileeMatthias Krüger-1/+1
fix typo in `rustdoc/src/what-is-rustdoc.md`
2023-07-02Auto merge of #108537 - ↵bors-0/+5
GuillaumeGomez:rustdoc-search-whitespace-as-separator, r=notriddle rustdoc: Allow whitespace as path separator like double colon Fixes https://github.com/rust-lang/rust/issues/108447. I think it makes sense since it allows more common cases, however it also makes the syntax heavier. Not sure what the rest of the team thinks about it. In any case we'll need to go through FCP. Full explanation for the changes is available [here](https://github.com/rust-lang/rust/pull/108537#issuecomment-1589480564). r? `@notriddle`
2023-07-01Document tracking issue for rustdoc `show-type-layout`Trevor Gross-0/+2
2023-06-17fix typo in `rustdoc/src/what-is-rustdoc.md`Joe Chen-1/+1
2023-06-15Rollup merge of #112304 - GuillaumeGomez:re-exports, r=notriddleMatthias Krüger-1/+180
Add chapter in rustdoc book for re-exports and add a regression test for `#[doc(hidden)]` behaviour Fixes https://github.com/rust-lang/rust/issues/109449. Fixes https://github.com/rust-lang/rust/issues/53417. After the discussion in #109697, I made a few PRs to fix a few corner cases: * https://github.com/rust-lang/rust/pull/112178 * https://github.com/rust-lang/rust/pull/112108 * https://github.com/rust-lang/rust/pull/111997 With this I think I covered all cases. Only thing missing at this point was a chapter covering re-exports in the rustdoc book. r? `@notriddle`
2023-06-14Add documentation for paths in rustdoc searchGuillaume Gomez-0/+5
2023-06-10rustdoc: update book with `[]` syntaxMichael Howell-0/+5
2023-06-05Add chapter for re-exports in the rustdoc bookGuillaume Gomez-1/+180
2023-05-25rustdoc book: document single tilde strikethroughLukas Markeffsky-3/+3
2023-04-29Add `rustdoc::unescaped_backtick` lintLukas Markeffsky-0/+38
2023-04-27Remove invalid value from scraped-examples.mdJohn Kelly-2/+2
2023-04-26Rollup merge of #110641 - GuillaumeGomez:rustdoc-in-doc-settings, r=notriddleMatthias Krüger-6/+66
Add new rustdoc book chapter to describe in-doc settings Fixes #55165. I continue going through old rustdoc issues. This one made a lot of sense so decided to add the missing chapter. r? ``@notriddle``
2023-04-26Rollup merge of #110418 - jsoref:spelling-rustdoc, r=jyn514jyn-5/+5
Spelling rustdoc Split per https://github.com/rust-lang/rust/pull/110392#issuecomment-1510148682
2023-04-22Add new rustdoc book chapter to describe in-doc settingsGuillaume Gomez-6/+66
2023-04-18Rollup merge of #110348 - ↵Matthias Krüger-3/+6
GuillaumeGomez:disambiguators-suffixes-rustdoc-book, r=Manishearth Add list of supported disambiguators and suffixes for intra-doc links in the rustdoc book This information is otherwise only provided in case an error occurs, which isn't great. r? ```@notriddle```
2023-04-17Add list of supported disambiguators and suffixes for intra-doc links in the ↵Guillaume Gomez-3/+6
rustdoc book
2023-04-16spelling: typographicalJosh Soref-1/+1
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-16spelling: githubJosh Soref-4/+4
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-15Auto merge of #109802 - notriddle:notriddle/rustdoc-search-generics-nested, ↵bors-0/+11
r=GuillaumeGomez rustdoc-search: add support for nested generics This change allows `search.js` to parse nested generics (which look `Like<This<Example>>`) and match them. It maintains the existing "bag semantics", so that the order of type parameters is ignored but the number is required to be greater than or equal to what's in the query. For example, a function with the signature `fn read_all(&mut self: impl Read) -> Result<Vec<u8>, Error>` will match these queries: * `Read -> Result<Vec<u8>, Error>` * `Read -> Result<Error, Vec>` * `Read -> Result<Vec<u8>>` But it *does not* match `Result<Vec, u8>` or `Result<u8<Vec>>`.
2023-04-14Update how-to-read-rustdoc.mdMichael Howell-0/+11
2023-04-14Rollup merge of #110328 - GuillaumeGomez:auto-disambiguation-proc-trait, ↵Matthias Krüger-0/+7
r=notriddle [rustdoc] Add explanations for auto-disambiguation when an intra doc link is resolved to a proc-macro and a trait at the same time Part of https://github.com/rust-lang/rust/issues/110111. r? `@notriddle`
2023-04-14Add explanations for auto-disambiguation when an intra doc link is resolved ↵Guillaume Gomez-0/+7
to a proc-macro and a trait at the same time
2023-04-14Rollup merge of #103682 - Swatinem:stable-run-directory, r=GuillaumeGomezYuki Okushi-1/+26
Stabilize rustdoc `--test-run-directory` This should resolve https://github.com/rust-lang/rust/issues/84674
2023-04-12Update rustdoc book content about `--extend-css` optionGuillaume Gomez-4/+1
2023-04-08Auto merge of #109767 - GuillaumeGomez:rm-mention-missing_doc_code_examples, ↵bors-3/+10
r=notriddle Remove mention of `missing_doc_code_examples` lint from rustdoc book Fixes https://github.com/rust-lang/rust/issues/109601. r? `@notriddle`
2023-03-31Stabilize rustdoc `--test-run-directory`Arpad Borsos-1/+26
2023-03-30Update documentation for rustc_doc_primitiveGuillaume Gomez-3/+3
2023-03-30Remove mention of `missing_doc_code_examples` lint from rustdoc bookGuillaume Gomez-3/+10
2023-03-26Rollup merge of #109593 - coop-rs:missing_doc_code_examples, r=GuillaumeGomezMatthias Krüger-1/+1
Rustdoc Book refer to rustdoc::missing_doc_code_examples. Fixes #109592. Fixes #109592. But, please see a related question at #109592 (item `2.`).
2023-03-25Rustdoc Book refer to rustdoc::missing_doc_code_examples. Fixes #109592.Peter Kehl-1/+1
2023-03-20doc: add generics improvements to rustdoc bookMichael Howell-5/+12
2023-02-21Update how-to-read-rustdoc.mdMichael Howell-0/+3
2023-01-08rustdoc: fix outdated lint section of the bookMichael Howell-1/+1
2022-12-27Fix doc comment parsingkraktus-2/+2
This can actually make a difference for the user if they rely on unicode formating. Prompted by https://github.com/dtolnay/syn/issues/771
2022-10-27doc(rustdoc): redirect more urlsWeihang Lo-0/+4