about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2023-03-17rustdoc: reduce allocations in `visibility_to_src_with_space`Michael Howell-7/+7
2023-03-17Add clarifying commentsMichael Howell-0/+3
2023-03-17extra_info_tags don't return string, use display_fnklensy-35/+56
2023-03-17rustdoc: Correctly merge import's and its target's docs in one more caseVadim Petrochenkov-6/+8
2023-03-17Only add into `view_item_stack` if the item will be inlinedGuillaume Gomez-4/+4
2023-03-17Rollup merge of #109229 - DaniPopes:link-references, r=notriddleMatthias Krüger-7/+7
Fix invalid markdown link references Fixes invalid link references in librustdoc's template documentation. `[text](link)` was interpreted as a relative path to the file, making the link invalid, while `[text][label]` references a label defined in the file itself: <https://www.markdownguide.org/basic-syntax/#reference-style-links>
2023-03-17Rollup merge of #109198 - compiler-errors:new-rpitit-default-body, r=spastorinoMatthias Krüger-1/+1
Install projection from RPITIT to default trait method opaque correctly 1. For new lowering strategy `-Zlower-impl-trait-in-trait-to-assoc-ty`, install the correct default trait method projection predicates (RPITIT -> opaque). This makes default trait body tests pass! 2. Fix two WF-checking bugs -- first, we want to make sure that we're always looking for an opaque type in `check_return_position_impl_trait_in_trait_bounds`. That's because the RPITIT projections are normalized to opaques during wfcheck. Second, fix RPITIT's param-envs by not adding the projection predicates that we install on trait methods to make default RPITITs work -- I left a comment why. 3. Also, just a small drive-by for `rustc_on_unimplemented`. Not sure if it affects any tests, but can't hurt. r? ````@spastorino,```` based off of #109140
2023-03-16Fix invalid markdown link referencesDaniPopes-7/+7
2023-03-16clean up few allocklensy-5/+3
2023-03-16Render source page layout with Askamaclubby789-69/+67
Co-authored-by: Michael Howell <michael@notriddle.com>
2023-03-16Rollup merge of #109185 - notriddle:notriddle/primitive-tooltip, r=jshaMatthias Krüger-0/+6
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`
2023-03-16Rollup merge of #109166 - lcnr:define_opaque_types-explicit, r=oli-obkMatthias Krüger-3/+2
make `define_opaque_types` fully explicit based on the idea of #108389. Moved `define_opaque_types` into the actual operations, e.g. `eq`, instead of `infcx.at` because normalization doesn't use `define_opaque_types` and even creates it's own `At` with a different `define_opaque_types` internally. Somewhat surprisingly, coherence actually relies on `DefineOpaqueTypes::Yes` for soundness which was revealed because I've incorrectly used `DefineOpaqueTypes::No` in `equate_impl_headers`. It feels concerning that even though this is the case, we still sometimes use `DefineOpaqueTypes::No` in coherence. I did not look into this as part of this PR as it is purely changing the structure of the code without changing behavior in any way. r? ```@oli-obk```
2023-03-16Rollup merge of #109139 - GuillaumeGomez:rustdoc-windows-wait-for-write, ↵Matthias Krüger-10/+22
r=notriddle rustdoc: DocFS: Replace rayon with threadpool and enable it for all targets Fixes https://github.com/rust-lang/rust/issues/109060. Switching to `threadpool` makes it a bit simpler for us to wait for all tasks in `DocFS` directly in the `Drop` implementation. I'm also curious if making all the writes into a thread pool could improve run time for rustdoc on all other platforms than Windows as well. I'll run a perf check to see. cc ```@ehuss``` r? ```@notriddle```
2023-03-16Rollup merge of #108875 - notriddle:notriddle/return-trait, r=GuillaumeGomezMatthias Krüger-2/+7
rustdoc: fix type search for `Option` combinators
2023-03-15ImplTraitPlaceholder -> is_impl_trait_in_traitSantiago Pastorino-1/+1
2023-03-15rustdoc: remove `std::` from primitive intra-doc link tooltipsMichael Howell-0/+6
2023-03-15Implementing "<test_binary> --list --format json" #107307 #49359Partha P. Das-0/+10
2023-03-15Update docsfs module documentationGuillaume Gomez-1/+0
2023-03-15always make `define_opaque_types` explicitlcnr-3/+2
2023-03-14rustdoc: DocFS: Replace rayon with threadpool and enable it for all targetsGuillaume Gomez-9/+22
2023-03-13Better names?Michael Goulet-1/+1
2023-03-13Treat projections with infer as placeholder during fast reject in new solverMichael Goulet-2/+2
2023-03-13Auto merge of #109011 - jsha:reduce-allocations-inner-full-print, r=notriddlebors-65/+71
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.
2023-03-12rustdoc: rename `Type::is_same` to `is_doc_subtype_of`Michael Howell-11/+11
2023-03-12Rollup merge of #109009 - notriddle:notriddle/edit-distance, r=GuillaumeGomezMatthias Krüger-149/+223
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!
2023-03-11rustdoc: collapse edit distance state into an objectMichael Howell-80/+86
2023-03-11rustdoc: reduce allocs in FnDecl::inner_full_printJacob Hoffman-Andrews-65/+71
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.
2023-03-11Rollup merge of #108784 - clubby789:askama-sidebar, r=jsha,GuillaumeGomezMatthias Krüger-644/+616
rustdoc: Migrate sidebar rendering to Askama cc #108757 Renders the sidebar for documentation using an Askama template
2023-03-11Rollup merge of #108757 - clubby789:askama-move, r=notriddle,jsha,GuillaumeGomezMatthias Krüger-43/+84
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.
2023-03-11Rollup merge of #107629 - pitaj:rustdoc-search-deprecated, r=jshaMatthias Krüger-9/+50
rustdoc: sort deprecated items lower in search closes #98759 ### Screenshots `i32::MAX` show sup above `std::i32::MAX` and `core::i32::MAX` ![image](https://user-images.githubusercontent.com/803701/216725619-40afb7b0-e984-4a2e-ab5b-a95b24736b0e.png) If just searching for `min`, the deprecated results show up far below other things: ![image](https://user-images.githubusercontent.com/803701/216725672-e4325d37-9bfe-47eb-a1fe-0e57092aa811.png) one page later ![image](https://user-images.githubusercontent.com/803701/216725932-cd1c4a42-d527-44fb-a4ab-5a6d243659cc.png) ~~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`: ![image](https://user-images.githubusercontent.com/803701/216726268-1657e77a-563f-45a0-85a7-3a0cf4d66d6f.png)~~ Edit: the deprecation message change was removed from this PR. Only the sorting is changed.
2023-03-10rustdoc: use restricted Damerau-Levenshtein distance for searchMichael Howell-147/+215
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-11Auto merge of #104527 - ferrocene:pa-more-licenses, r=pnkfelixbors-0/+21
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`
2023-03-10Render doc sidebar using Askamaclubby789-644/+616
2023-03-10Migrate `document_item_info` to templatesclubby789-43/+84
2023-03-10rustdoc: sort deprecated items lower in searchPeter Jaszkowiak-9/+50
serialize `q` (`itemPaths`) sparsely overall 4% reduction in search index size
2023-03-10Rollup merge of #108936 - GuillaumeGomez:rustdoc-anonymous-reexport, r=notriddleMatthias Krüger-2/+7
Rustdoc: don't hide anonymous reexport Fixes https://github.com/rust-lang/rust/issues/108931. From https://github.com/rust-lang/rust/issues/108931, it appears that having anonymous re-exports for traits is actually used in some places, so instead of hiding them automatically, we should prevent them to be ever inlined. r? `@notriddle`
2023-03-09rustdoc: handle generics better when matching notable traitsMichael Howell-6/+55
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.
2023-03-09Don't hide anonymous re-exports but never inline themGuillaume Gomez-2/+7
2023-03-09avoid reuse tripping over copyright noticesPietro Albini-0/+21
2023-03-09Rollup merge of #108929 - eltociear:patch-20, r=GuillaumeGomezMatthias Krüger-3/+3
Fix typo in span_map.rs correspondance -> correspondence
2023-03-09Rollup merge of #108870 - ↵Matthias Krüger-43/+85
GuillaumeGomez:rustdoc-reexport-of-reexport-of-private, r=notriddle Fix invalid inlining of reexport of reexport of private item Fixes https://github.com/rust-lang/rust/issues/108679. The problem is that a reexport is always resolving to the end type, so if the end type is private, the reexport inlines. Except that if you reexport a public reexport (which reexports the private item), then it should not be inlined again. r? `@notriddle`
2023-03-09Rollup merge of #106915 - notriddle:notriddle/load-only-one-theme, ↵Matthias Krüger-53/+100
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
2023-03-09Fix typo in span_map.rsIkko Eltociear Ashimine-3/+3
correspondance -> correspondence
2023-03-08Rollup merge of #108686 - notriddle:notriddle/jank-all, r=jshaMatthias Krüger-3/+1
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 | |------------|----------| | ![image](https://user-images.githubusercontent.com/1593513/222607866-4eac3f55-314c-4273-9664-503f2a79ad0a.png) | ![image](https://user-images.githubusercontent.com/1593513/222607895-2d6bac3b-f66a-47d4-b234-360f6f8e1ee3.png) | ## After | index.html | all.html | |------------|----------| | ![image](https://user-images.githubusercontent.com/1593513/222607866-4eac3f55-314c-4273-9664-503f2a79ad0a.png) | ![image](https://user-images.githubusercontent.com/1593513/222607997-e72c48a0-02c7-42a7-80c2-cd6bed48bd15.png) |
2023-03-08Update src/librustdoc/html/static/js/storage.jsMichael Howell-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2023-03-08Fix eslint errorsGuillaume Gomez-0/+1
2023-03-08Only load one CSS theme by defaultMichael Howell-53/+99
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>
2023-03-07Fix invalid inlining of reexport of reexport of private itemGuillaume Gomez-43/+85
2023-03-07rustdoc: fix type search when more than one `where` clause appliesMichael Howell-1/+1
2023-03-07rustdoc: fix type search index for `fn<T>() -> &T where T: Trait`Michael Howell-1/+6