| Age | Commit message (Collapse) | Author | Lines |
|
r=GuillaumeGomez
rustdoc: implement bag semantics for function parameter search
This tweak to the function signature search engine makes things so that, if a type is repeated in the search query, it'll only match if the function actually includes it that many times.
|
|
rustdoc: cleanup some intermediate allocs
First commit self contained, second one use `display_fn` for `extra_info_tags`
|
|
|
|
This tweak to the function signature search engine makes things so that,
if a type is repeated in the search query, it'll only match if the
function actually includes it that many times.
|
|
|
|
|
|
|
|
|
|
|
|
Co-authored-by: Michael Howell <michael@notriddle.com>
|
|
rustdoc: remove `std::` from primitive intra-doc link tooltips
Take the intra-doc link to the method `iter` from https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html
Before: `method std::slice::iter`
After: `method slice::iter`
|
|
rustdoc: fix type search for `Option` combinators
|
|
|
|
rustdoc: reduce allocs in FnDecl::inner_full_print
Instead of maintaining parallel buffers for both HTML and non-HTML output, follow the idiom from the rest of format.rs that f.alternate() == true means textual output. Also, add an argument to control line wrapping explicitly.
This allows the caller to render once with textual output and no line wrapping, to decide whether line wrapping should be applied in the final HTML output.
Also, remove some format! and " ".repeat calls, and remove a dependency on calling `String::replace` to switch from newlines to spaces.
This coincidentally fixes some minor bugs where the old code was undercounting the number of characters for a declaration in text mode.
|
|
|
|
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.
[`prinltn!`]: https://doc.rust-lang.org/nightly/std/?search=prinltn!
|
|
|
|
Instead of maintaining parallel buffers for both HTML and non-HTML output,
follow the idiom from the rest of format.rs that f.alternate() == true means
textual output. Also, add an argument to control line wrapping explicitly.
This allows the caller to render once with textual output and no line wrapping,
to decide whether line wrapping should be applied in the final HTML output.
Also, remove some format! and " ".repeat calls, and remove a dependency on
calling `String::replace` to switch from newlines to spaces.
This coincidentally fixes some minor bugs where the old code was undercounting
the number of characters for a declaration in text mode.
|
|
rustdoc: Migrate sidebar rendering to Askama
cc #108757
Renders the sidebar for documentation using an Askama template
|
|
rustdoc: Migrate `document_item_info` to Askama
https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/rustdoc.20allocations.20are.20slow
Hoping to piece-by-piece migrate things to template. Had a few failed attempts at more complex parts of the code, so this is just a start.
|
|
rustdoc: sort deprecated items lower in search
closes #98759
### Screenshots
`i32::MAX` show sup above `std::i32::MAX` and `core::i32::MAX`

If just searching for `min`, the deprecated results show up far below other things:

one page later

~~And, as you can see, the "Deprecation planned" message shows up in the search results. The same is true for fully-deprecated items like `mem::uninitialized`:
~~
Edit: the deprecation message change was removed from this PR. Only the sorting is changed.
|
|
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.
|
|
Add more license annotations
This PR updates the `.reuse/dep5` file to include more accurate licensing data for everything in the repository (*excluding* submodules and dependencies). Some decisions were made in this PR:
* The standard copyright attribution for files maintained by us is "The Rust Project Developers (see https://thanks.rust-lang.org)", to avoid having to maintain an in-tree `AUTHORS` file.
* For files that have specific licensing terms, we added the terms to the `.reuse/dep5` rather than adding SPDX comments in the files themselves.
* REUSE picks up any comment/text line with `Copyright` on it, so I had to sprinkle around `REUSE-IgnoreStart` and `REUSE-IgnoreEnd` comments.
The rendered `COPYRIGHT` file is available at https://gist.github.com/pietroalbini/efb81103f69596d39758114f3f6a8688.
r? `@pnkfelix`
|
|
|
|
|
|
serialize `q` (`itemPaths`) sparsely
overall 4% reduction in search index size
|
|
This commit makes the `clean::Type::is_same` non-commutative, so
that a generic `impl` matches a concrete return, but a generic return
does not match a concrete `impl`. It makes slice and vector Write
for `u8` not match on every generic return value.
|
|
|
|
Fix typo in span_map.rs
correspondance -> correspondence
|
|
r=GuillaumeGomez,jsha
Only load one CSS theme by default
This is a tweaked version of #103971 that uses `document.write` to create the stylesheet link at startup, avoiding a FOUC during page navigation. It also rebases the PR, making it work with the new hashed filenames.
Fixes #82614
Preview: http://notriddle.com/notriddle-rustdoc-demos/load-only-one-theme-v2/std/index.html
|
|
correspondance -> correspondence
|
|
rustdoc: include link on all.html location header
This avoids a subtle layout shift when switching from the crate page to all items.
## Before
| index.html | all.html |
|------------|----------|
|  |  |
## After
| index.html | all.html |
|------------|----------|
|  |  |
|
|
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
|
|
|
|
To avoid generating a FOUC at startup, this commit uses `document.write` to
load the stylesheet initially.
Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
|
|
|
|
|
|
|
|
|
|
rustc_middle: Remove trait `DefIdTree`
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
|
|
rustdoc: Note in a type's layout/size if it is uninhabited
Closes #87008

|
|
rustdoc: function signature search with traits in `where` clause
## Before

## After

|
|
This avoids a subtle layout shift when switching from the crate page
to all items.
|
|
|
|
|
|
|
|
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
|
|
|
|
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`](https://github.com/notriddle/rust/blob/08ad401633037cc226b3806a3c5f48c2f34703bf/tests/rustdoc-js-std/alias-3.js)
## Before

## After

|
|
r=GuillaumeGomez
rustdoc: reduce allocations when generating tooltips
An attempt to reduce the perf regression in
https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
|