rust/src/librustdoc
bors 81c02da94e Auto merge of #111958 - notriddle:notriddle/type-search-slice-array, r=GuillaumeGomez
rustdoc: search for slices and arrays by type with `[]`

This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for slices and arrays. Part of #60485

Function signature searches already support arrays and slices. The explicit name `primitive:slice<u8>` and `primitive:array<u8>` can be used to match a slice or array of bytes, while square brackets `[u8]` will match either one. Empty square brackets, `[]`, will match any slice regardless of what it contains.

Preview:

* [`option -> []`](https://notriddle.com/rustdoc-demo-html-3/search-slice-array/std/index.html?search=option%20-%3E%20%5B%5D)
* [`[u8] -> str`](https://notriddle.com/rustdoc-demo-html-3/search-slice-array/std/index.html?search=%5Bu8%5D%20-%3E%20str)
* [`Box<[u8]> -> str`](https://notriddle.com/rustdoc-demo-html-3/search-slice-array/std/index.html?search=Box%3C%5Bu8%5D%3E%20-%3E%20str)

Motivation:

When type-based search was first landed, it was directly described as "incomplete". Here's [a comment] from the discussion thread:

[a comment]: https://github.com/rust-lang/rust/pull/23289#issuecomment-79437386

> This is looking really great, nice work! I can think of a number of cases that aren't quite covered by this, but I feel like this is a great improvement regardless and it can always be iterated on so I'm fine landing with a few known cases where it may not work :)

Filling out the missing functionality is going to mean adding support for more of Rust's [type expression] syntax, such as slices (in this PR), tuples, references, raw pointers, function pointers, and generics.

[type expression]: https://doc.rust-lang.org/reference/types.html#type-expressions

There does seem to be demand for this sort of thing, such as [this Discord message](https://discord.com/channels/442252698964721669/443150878111694848/1042145740065099796) expressing regret at rustdoc not supporting tuples in search queries.
2023-06-11 14:48:58 +00:00
..
clean use wf::object_region_bounds 2023-06-07 13:29:36 +02:00
doctest pass unused_extern_crates in librustdoc::doctest::make_test 2023-04-25 17:20:58 +03:00
formats Rollup merge of #112018 - GuillaumeGomez:cleanup-tcx, r=notriddle 2023-05-27 20:40:29 +02:00
html Auto merge of #111958 - notriddle:notriddle/type-search-slice-array, r=GuillaumeGomez 2023-06-11 14:48:58 +00:00
json rustdoc: simplify clean by removing FnRetTy 2023-05-30 12:22:14 -07:00
passes Rename impl_defaultness to defaultness 2023-06-01 06:14:06 +00:00
theme Spelling librustdoc 2023-04-16 21:44:12 -04:00
askama.toml Remove unneeded minus sign in jinja tags 2023-03-06 11:38:15 +01:00
Cargo.toml rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets 2023-03-14 20:28:00 +01:00
config.rs Rollup merge of #109084 - dekrain:fix-panic-arg0-expansion, r=petrochenkov 2023-05-27 20:40:27 +02:00
core.rs rustdoc: Cleanup doc string collapsing 2023-05-22 19:35:35 +03:00
docfs.rs Update docsfs module documentation 2023-03-15 16:47:14 +01:00
doctest.rs rustdoc: Cleanup doc string collapsing 2023-05-22 19:35:35 +03:00
error.rs Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
externalfiles.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
fold.rs clean: Always store enum disriminant. 2023-01-01 18:11:53 +00:00
lib.rs Rollup merge of #109084 - dekrain:fix-panic-arg0-expansion, r=petrochenkov 2023-05-27 20:40:27 +02:00
lint.rs Add rustdoc::unescaped_backtick lint 2023-04-29 13:13:25 +02:00
markdown.rs Turn MarkdownWithToc into a struct with named fields 2023-02-06 16:31:17 +01:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
scrape_examples.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
theme.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
visit.rs clean: Always store enum disriminant. 2023-01-01 18:11:53 +00:00
visit_ast.rs rustdoc: convert if let Some() that always matches to variable 2023-06-06 12:20:54 -07:00
visit_lib.rs rustdoc: Eliminate remaining uses of resolver 2023-02-13 00:10:15 +04:00

For more information about how librustdoc works, see the rustc dev guide.