summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2024-08-31Auto merge of #129831 - matthiaskrgr:rollup-befq6zx, r=matthiaskrgrbors-2/+8
Rollup of 11 pull requests Successful merges: - #128523 (Add release notes for 1.81.0) - #129605 (Add missing `needs-llvm-components` directives for run-make tests that need target-specific codegen) - #129650 (Clean up `library/profiler_builtins/build.rs`) - #129651 (skip stage 0 target check if `BOOTSTRAP_SKIP_TARGET_SANITY` is set) - #129684 (Enable Miri to pass pointers through FFI) - #129762 (Update the `wasm-component-ld` binary dependency) - #129782 (couple more crash tests) - #129816 (tidy: say which feature gate has a stability issue mismatch) - #129818 (make the const-unstable-in-stable error more clear) - #129824 (Fix code examples buttons not appearing on click on mobile) - #129826 (library: Fix typo in `core::mem`) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-31Rollup merge of #129824 - GuillaumeGomez:code-example-buttons-mobile, ↵Matthias Krüger-2/+8
r=notriddle Fix code examples buttons not appearing on click on mobile When browsing docs on mobile today, I realized that the buttons didn't appear when I tapped on the code example. One issue: I have no idea how to add a regression test for this case... r? ``@notriddle``
2024-08-31Fix code examples buttons not appearing on click on mobileGuillaume Gomez-2/+8
2024-08-31Rollup merge of #129774 - nnethercote:rm-extern-crate-tracing-remainder, ↵Matthias Krüger-0/+8
r=GuillaumeGomez Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt A follow-up to #129767 and earlier PRs doing this for `rustc_*` crates. r? ```@GuillaumeGomez```
2024-08-31Rollup merge of #126183 - Folyd:search-core, r=GuillaumeGomez,notriddleMatthias Krüger-2277/+2316
Separate core search logic with search ui Currenty, the `search.js` mixed with UI/DOM manipulation codes and search logic codes, I propose to extract the search logic to a class for following benefits: - Clean code. Separation of DOM manipulation and search logic can lead better code maintainability and easy code testings. - Easy share the search logic for third party to utilize the search function, such as [Rust Search Extension](https://rust.extension.sh), https://query.rs. This PR added a new class called `DocSearch`, which mainly expose following methods: ```js class DocSearch { // Dependency inject searchIndex, rootPath and searchState constructor(rawSearchIndex, rootPath, searchState) { // build search index... } static parseQuery(userQuery) { } async execQuery(parsedQuery, filterCrates, currentCrate) { } } ```
2024-08-30Remove `#[macro_use] extern crate tracing` from rustdoc.Nicholas Nethercote-0/+8
2024-08-29Rollup merge of #129743 - GuillaumeGomez:fix-rustdoc-clippy, r=notriddleGuillaume Gomez-10/+9
Fix rustdoc clippy lints Ran clippy on rustdoc and fixed the errors. r? `@notriddle`
2024-08-29Fix clippy lintsGuillaume Gomez-10/+9
2024-08-29Separate core search logic with search uiFolyd-2277/+2316
2024-08-26rustdoc: fix missing resource suffix on `crates.js`Michael Howell-9/+15
Fixes a regression introduced in #128252.
2024-08-27Rollup merge of #129560 - GuillaumeGomez:impl-assoc-type-source-link, ↵Matthias Krüger-0/+2
r=notriddle [rustdoc] Generate source link on impl associated types Currently, impl associated types are generated but don't get a source link. This PR fixes that. Before: ![image](https://github.com/user-attachments/assets/3a22adb5-8b66-4124-9267-7c26eed1aa5e) After: ![Screenshot from 2024-08-25 16-31-36](https://github.com/user-attachments/assets/6e9b35e7-4357-4ecf-8c49-1d8294051283) r? `@notriddle`
2024-08-26Rollup merge of #129525 - notriddle:notriddle/fake-variadic-tuple-array, ↵Matthias Krüger-40/+74
r=GuillaumeGomez rustdoc: clean up tuple <-> primitive conversion docs This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-25Generate missing source link on impl associated typesGuillaume Gomez-0/+2
2024-08-24Rollup merge of #129430 - lolbinarycat:rustdoc-search-exact-case, r=notriddleTrevor Gross-0/+8
rustdoc: show exact case-sensitive matches first fixes #119480
2024-08-24rustdoc: clean up tuple <-> primitive conversion docsMichael Howell-40/+74
This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-23rustdoc: show exact case-sensitive matches firstbinarycat-0/+8
fixes #119480
2024-08-22rustdoc-search: use tighter json for names and parentsMichael Howell-13/+40
File size --------- ```console $ du -hs doc.old/search-index1.82.0.js doc/search-index1.82.0.js 3.2M doc.old/search-index1.82.0.js 2.8M doc/search-index1.82.0.js $ gzip doc/search-index1.82.0.js $ gzip doc.old/search-index1.82.0.js $ du -hs doc.old/search-index1.82.0.js.gz doc/search-index1.82.0.js.gz 464K doc.old/search-index1.82.0.js.gz 456K doc/search-index1.82.0.js.gz $ du -hs compiler-doc.old/search-index.js compiler-doc/search-index.js 8.5M compiler-doc.old/search-index.js 6.5M compiler-doc/search-index.js $ gzip compiler-doc/search-index1.82.0.js $ gzip compiler-doc.old/search-index1.82.0.js $ du -hs compiler-doc.old/search-index.js.gz compiler-doc/search-index.js.gz 1.4M compiler-doc.old/search-index.js.gz 1.4M compiler-doc/search-index.js.gz ```
2024-08-21Rollup merge of #129284 - notriddle:notriddle/animate-target=light, ↵Matthias Krüger-0/+13
r=GuillaumeGomez rustdoc: animate the `:target` highlight This approach is, roughly, based on how Discourse does it. It came up while discussing [some other possible sidebar changes](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Moving.20deprecated.20items.20out.20of.20the.20way), as a design that made rapid scanning easier while avoiding the inherent trade-offs in summarizing. https://github.com/user-attachments/assets/f7a8fec3-70a5-40a1-92ea-bfdffbd61c22
2024-08-21Auto merge of #129331 - matthiaskrgr:rollup-rxv463w, r=matthiaskrgrbors-24/+20
Rollup of 9 pull requests Successful merges: - #128662 (Lint on tail expr drop order change in Edition 2024) - #128932 (skip updating when external binding is existed) - #129270 (Don't consider locals to shadow inner items' generics) - #129277 (Update annotate-snippets to 0.11) - #129294 (Stabilize `iter::repeat_n`) - #129308 (fix: simple typo in compiler directory) - #129309 (ctfe: make CompileTimeInterpCx type alias public) - #129314 (fix a broken link in `mir/mod.rs`) - #129318 (Remove unneeded conversion to `DefId` for `ExtraInfo`) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-20Auto merge of #128252 - EtomicBomb:pre-rfc, r=notriddlebors-683/+1551
modularize rustdoc's write_shared Refactor src/librustdoc/html/render/write_shared.rs to reduce code duplication, adding unit tests * Extract + unit test code for sorting and rendering JSON, which is duplicated 9 times in the current impl * Extract + unit test code for encoding JSON as single quoted strings, which is duplicated twice in the current impl * Unit tests for cross-crate information file formats * Generic interface to add new kinds of cross-crate information files in the future * Intended to match current behavior exactly, except for a merge info comment it adds to the bottom of cci files * This PR is intended to reduce the review burden from my [mergeable rustdoc rfc](https://github.com/rust-lang/rfcs/pull/3662) implementation PR, which is a [small commit based on this branch](https://github.com/EtomicBomb/rust/tree/rfc). This code is agnostic to the RFC and does not include any of the flags discussed there, but cleanly enables the addition of these flags in the future because it is more modular
2024-08-20Remove unneeded conversion to `DefId` for `ExtraInfo`Guillaume Gomez-24/+20
2024-08-19rustdoc: animate the `:target` highlightMichael Howell-0/+13
This approach is, roughly, based on how Discourse does it. It came up while discussing some other possible sidebar changes, as a design that made rapid scanning easier while avoiding the inherent trade-offs in summarizing.
2024-08-13Unify naming of `DocTest`Guillaume Gomez-2/+2
2024-08-13Improve code readabilityGuillaume Gomez-1/+1
2024-08-13Rename `DocTest` into `DocTestBuilder`Guillaume Gomez-1/+1
2024-08-13Correctly handle doctests with invalid ASTGuillaume Gomez-1/+1
2024-08-13Add new doc codeblock `standalone` attributeGuillaume Gomez-0/+6
2024-08-13Split standalone and mergeable doctestsGuillaume Gomez-2/+2
2024-08-13Split doctests between standalone and mergeable onesGuillaume Gomez-2/+2
2024-08-13Add `DocTest` typeGuillaume Gomez-2/+3
2024-08-12Rollup merge of #128394 - GuillaumeGomez:run-button, r=t-rustdocGuillaume Gomez-44/+29
Unify run button display with "copy code" button and with mdbook buttons Follow-up of https://github.com/rust-lang/rust/pull/128339. It looks like this (coherency++, yeay!): ![Screenshot from 2024-07-30 15-16-31](https://github.com/user-attachments/assets/5e262e5b-f338-4085-94ca-e223033a43db) Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
2024-08-10Rollup merge of #128923 - GuillaumeGomez:negative-impls-items, r=fmeaseGuillaume Gomez-19/+23
[rustdoc] Stop showing impl items for negative impls Fixes https://github.com/rust-lang/rust/issues/128799. As discussed with `@fmease,` they have a broader patch in progress, so this (small) PR will at least allow for them to have a regression test. :) r? `@fmease`
2024-08-10Stop showing impl items for negative implsGuillaume Gomez-19/+23
2024-08-08rustdoc: do not run doctests with invalid langstringsMichael Howell-7/+19
2024-08-08fix typos, more SelfEtomicBomb-17/+13
typos in comments, remove references to crate-info, Self type in ordered_json and sorted_template
2024-08-07rename sortedjson -> orderedjsonEtomicBomb-192/+227
2024-08-07added unit tests for write_sharedEtomicBomb-51/+257
2024-08-07move sorted_template and sorted_json testsEtomicBomb-271/+270
2024-08-07add blank line, remove extraneous commentEtomicBomb-1/+0
2024-08-07initial implementation of mergable rustdoc cciEtomicBomb-682/+1315
2024-08-06rustdoc-search: account for numeric disambiguators on implsMichael Howell-6/+12
Fixes #128676
2024-08-05Prevent clicking on a link or on a button to toggle the code example buttons ↵Guillaume Gomez-2/+6
visibility
2024-08-05Unify run button display with "copy code" button and with mdbook buttonsGuillaume Gomez-42/+23
2024-08-04rustdoc: Delete `ReceiverTy` (formerly known as `SelfTy`)Noah Lev-23/+15
It was barely used, and the places that used it are actually clearer without it since they were often undoing some of its work. This also avoids an unnecessary clone of the receiver type and removes a layer of logical indirection in the code.
2024-08-04Use `match` instead of sequence of `if let`sNoah Lev-234/+243
This is much more readable and idiomatic, and also may help performance since `match`es usually use switches while `if`s may not. I also fixed an incorrect comment.
2024-08-04rustdoc: Stop treating `Self` as a generic in search indexNoah Lev-6/+1
We already have special-cased code to handle inlining `Self` as the type or trait it refers to, and this was just causing glitches like the search `A -> B` yielding blanket `Into` impls.
2024-08-04rustdoc: Create `SelfTy` to replace `Generic(kw::SelfUpper)`Noah Lev-3/+13
Rustdoc often has to special-case `Self` because it is, well, a special type of generic parameter (although it also behaves as an alias in concrete impls). Instead of spreading this special-casing throughout the code base, create a new variant of the `clean::Type` enum that is for `Self` types. This is a refactoring that has almost no impact on rustdoc's behavior, except that `&Self`, `(Self,)`, `&[Self]`, and other similar occurrences of `Self` no longer link to the wrapping type (reference primitive, tuple primitive, etc.) as regular generics do. I felt this made more sense since users would expect `Self` to link to the containing trait or aliased type (though those are usually expanded), not the primitive that is wrapping it. For an example of the change, see the docs for `std::alloc::Allocator::by_ref`.
2024-08-04rustdoc: Rename `SelfTy` to `ReceiverTy`Noah Lev-8/+8
`SelfTy` makes it sound like it is literally the `Self` type, whereas in fact it may be `&Self` or other types. Plus, I want to use the name `SelfTy` for a new variant of `clean::Type`. Having both causes resolution conflicts or at least confusion.
2024-08-04Rollup merge of #128615 - notriddle:notriddle/anchor-a11y, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: make the hover trail for doc anchors a bit bigger https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Weird.20markdown.20heading.20rendering.3F r? ```@GuillaumeGomez``` ### Screenshots (the purple part is the padding, which the mouse can pass through to hover over it) | Before | After | |--|--| | ![image](https://github.com/user-attachments/assets/5070eebe-84ac-4f5d-8950-58664370191c) | ![image](https://github.com/user-attachments/assets/55340161-ad8a-41bd-a120-8cdab11f4af0)
2024-08-03rustdoc: make the hover trail for doc anchors a bit biggerMichael Howell-1/+1
https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Weird.20markdown.20heading.20rendering.3F