rust/src
Matthias Krüger 2f51bad66b
Rollup merge of #119331 - notriddle:notriddle/maxpatheditdistance, r=GuillaumeGomez
rustdoc-search: count path edits with separate edit limit

Avoids strange-looking results like this one, where the path component seems to be ignored:

![image](https://github.com/rust-lang/rust/assets/1593513/f0ef077a-6e09-4d67-a29d-8cabc1495f66)

Since the two are counted separately elsewhere, they should get their own limits, too. The biggest problem with combining them is that paths are loosely checked by not requiring every component to match, which means that if they are short and matched loosely, they can easily find "drunk typist" matches that make no sense, like this old result:

    std::collections::btree_map::itermut matching slice::itermut
    maxEditDistance = ("slice::itermut".length) / 3 = 14 / 3 = 4
    editDistance("std", "slice") = 4
    editDistance("itermut", "itermut") = 0
        4 + 0 <= 4 PASS

Of course, `slice::itermut` should not match stuff from btreemap. `slice` should not match `std`.

The new result counts them separately:

    maxPathEditDistance = "slice".length / 3 = 5 / 3 = 1
    maxEditDistance = "itermut".length / 3 = 7 / 3 = 2
    editDistance("std", "slice") = 4
        4 <= 1 FAIL

Effectively, this makes path queries less "typo-resistant". It's not zero, but it means `vec` won't match the `v1` prelude.

This commit also adds substring matching to paths. It's stricter than the substring matching in the main part, but loose enough that what I expect to match does.

Queries without parent paths are unchanged.
2023-12-28 18:48:00 +01:00
..
bootstrap Update sysinfo version to 0.30.1 2023-12-25 22:44:49 +01:00
ci Auto merge of #119283 - GuillaumeGomez:warning-block-pos, r=notriddle 2023-12-25 02:08:21 +00:00
doc Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebank 2023-12-26 12:27:29 +00:00
etc Auto merge of #106790 - the8472:rawvec-niche, r=scottmcm 2023-12-20 02:19:10 +00:00
librustdoc Rollup merge of #119331 - notriddle:notriddle/maxpatheditdistance, r=GuillaumeGomez 2023-12-28 18:48:00 +01:00
llvm-project@606bc11367 Update LLVM submodule 2023-12-20 16:50:43 +03:00
rustdoc-json-types Add is_object_safe information for traits in JSON output 2023-12-23 11:43:31 +01:00
tools Update cargo 2023-12-26 21:04:15 -05:00
README.md Remove stale reference to the test suite location 2023-01-13 11:49:06 +00:00
stage0.json bump stage0 2023-12-22 11:04:31 +01:00
version bump version number to 1.77.0 2023-12-21 10:58:56 +01:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.