Commit Graph

29 Commits

Author SHA1 Message Date
bors bf0e22b298 Auto merge of #108537 - 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-02 18:49:29 +00:00
bors 314c39d2ea Auto merge of #112233 - notriddle:notriddle/search-unify, r=GuillaumeGomez
rustdoc-search: clean up type unification and "unboxing"

This PR redesigns parameter matching, return matching, and generics matching to use a single function that compares two lists of types.

It also makes the algorithms more consistent, so the "unboxing" behavior where `Vec<i32>` is considered a match for `i32` works inside generics, and not just at the top level.
2023-06-15 03:04:46 +00:00
Guillaume Gomez e4ee329865 Fix eBNF and handling of whitespace characters when not in a path 2023-06-14 14:22:17 +02:00
Guillaume Gomez 7dc684f173 Add "vec new" test 2023-06-14 14:22:17 +02:00
Guillaume Gomez b5f8258497 Update rustdoc-js-std tests 2023-06-14 14:22:17 +02:00
Michael Howell db277f5284 rustdoc-search: search never type with `!`
This feature extends rustdoc to support the syntax that most users will
naturally attempt to use to search for diverging functions.
Part of #60485

It's already possible to do this search with `primitive:never`, but
that's not what the Rust language itself uses, so nobody will try it if
they aren't told or helped along.
2023-06-12 17:30:23 -07:00
Michael Howell 94badbe599 rustdoc-search: fix order-independence bug 2023-06-11 18:57:33 -07:00
Michael Howell c897deddb8 rustdoc-search: add test case for `bufread -> result<u8>` 2023-06-11 18:19:41 -07:00
Michael Howell d3a4cd6813 rustdoc: add note about slice/array searches to help popup 2023-06-10 14:08:26 -07:00
Michael Howell 2e569274d3 rustdoc: search for slices and arrays by type with `[]`
Part of #60485
2023-06-10 13:52:54 -07:00
Michael Howell 3ed4c17d90 rustdoc: add test case for `OsString::into_string` 2023-06-10 13:50:40 -07:00
Guillaume Gomez 9803651ee8 Update rustdoc-js* format 2023-06-09 17:00:47 +02:00
Michael Howell afee2411e3 rustdoc-search: add support for nested generics 2023-04-14 14:55:45 -07:00
Michael Howell e600c0ba0e rustdoc: add support for type filters in arguments and generics
This makes sense, since the search index has the information in it,
and it's more useful for function signature searches since a
function signature search's item type is, by definition, some type
of function (there's more than one, but not very many).
2023-03-20 22:41:57 -07:00
Matthias Krüger aa881f16ec
Rollup merge of #108875 - notriddle:notriddle/return-trait, r=GuillaumeGomez
rustdoc: fix type search for `Option` combinators
2023-03-16 08:57:05 +01:00
Michael Howell dfd9e5e3fa rustdoc: use restricted Damerau-Levenshtein distance for search
Based on https://github.com/rust-lang/rust/pull/108200, for the same
rationale.

> This replaces the existing Levenshtein algorithm with the
> Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change
> (a transposition) instead of two (a deletion and insertion). More
> specifically, this is a restricted implementation, in that "ca" to "abc"
> cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the
> middle of a transposition. I believe that errors like that are sufficiently
> rare that it's not worth taking into account.

Before this change, searching `prinltn!` listed `print!` first, followed
by `println!`. With this change, `println!` matches more closely.
2023-03-10 19:47:08 -07:00
Michael Howell 44813e038c rustdoc: fix type search when more than one `where` clause applies 2023-03-07 11:37:04 -07:00
Matthias Krüger 9cabc40ab1
Rollup merge of #108723 - notriddle:notriddle/where-clause, r=GuillaumeGomez
rustdoc: function signature search with traits in `where` clause

## Before

![image](https://user-images.githubusercontent.com/1593513/222873534-a640a72a-c654-4702-9f3b-175129d9591d.png)

## After

![image](https://user-images.githubusercontent.com/1593513/222873544-fdfc431d-2b65-4b56-bede-0302ea9f153a.png)
2023-03-04 20:48:18 +01:00
Michael Howell 9d27028391 rustdoc: function signature search with traits in `where` clause 2023-03-04 09:05:57 -07:00
Guillaume Gomez 823671589f Add test for unclosed generic 2023-03-03 20:49:25 +01:00
Guillaume Gomez cfb4af87e3 Add GUI test for rustdoc search errors background 2023-03-02 12:59:04 +01:00
Dylan DPC f03e5345aa
Rollup merge of #108143 - notriddle:notriddle/filter-exclamation-macro, r=GuillaumeGomez
rustdoc: search by macro when query ends with `!`

Related to #96399

Note: the `never` type alias is tested in [`/tests/rustdoc-js-std/alias-3.js`](08ad401633/tests/rustdoc-js-std/alias-3.js)

## Before

![image](https://user-images.githubusercontent.com/1593513/219504192-54cc0753-ff97-4a37-ad4a-8ae915181325.png)

## After

![image](https://user-images.githubusercontent.com/1593513/219504251-589a7e11-1e7b-4b7b-879d-1b564080017c.png)
2023-03-01 23:40:18 +05:30
Michael Howell 4de9c6d491 rustdoc: search by macro when query ends with `!`
Related to #96399
2023-02-16 18:16:09 -07:00
Michael Howell 5eba3f688c rustdoc: hide `reference` methods in search index 2023-02-16 17:21:57 -07:00
Michael Howell 616a0db7d6 rustdoc: add test case based on #103357 2023-01-24 09:49:33 -07:00
Michael Howell 39fd4bb476 rustdoc: update test cases to match with stricter match criteria 2023-01-21 00:11:39 -07:00
Michael Howell e09e6df787 rustdoc: compute maximum Levenshtein distance based on the query
The heuristic is pretty close to the name resolver.

Fixes #103357
2023-01-21 00:11:39 -07:00
Michael Howell db558b4686 rustdoc: update search test cases 2023-01-14 12:04:12 -07:00
Albert Larsan cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00