about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2024-11-10ensure that all publicly reachable const fn have const stability infoRalf Jung-3/+1
2024-11-01rustdoc: Directly use rustc_abi instead of reexportsJubilee Young-5/+5
rustc_target reexports a lot of things that are in rustc_abi, but that will be over soon and now is probably a good time to switch. Uses of rustc_target remain where they inquire about the target tuple.
2024-10-31Adjust ranking so that duplicates count against rankMichael Howell-14/+11
2024-10-30rustdoc-search: simplify rules for generics and type paramsMichael Howell-91/+335
This commit is a response to feedback on the displayed type signatures results, by making generics act stricter. Generics are tightened by making order significant. This means `Vec<Allocator>` now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so `Result<A, B>` only matches if `B` is in the error type and `A` is in the success type. The top level of the function search is unaffected. Find the discussion on: * <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149> * <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265> * <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363>
2024-10-30rustdoc-search: show types signatures in resultsMichael Howell-85/+627
2024-10-30rustdoc-search: use correct type annotationsMichael Howell-2/+2
2024-10-30rustdoc-search: pass original names through ASTMichael Howell-20/+26
2024-10-30rustdoc-search: simplify the checkTypes fast pathMichael Howell-26/+11
This reduces code size while still matching the common case for plain, concrete types.
2024-10-30rustdoc-search: add type param names to indexMichael Howell-7/+39
2024-10-29update toolslcnr-3/+2
2024-10-28Rollup merge of #132258 - GuillaumeGomez:variant-structfields-margins, ↵Jubilee-1/+1
r=notriddle [rustdoc] Unify variant struct fields margins with struct fields As discussed in https://github.com/rust-lang/rust/pull/132220. | before | after | |-|-| | ![image](https://github.com/user-attachments/assets/d8d8336d-7fe4-45fb-a5a5-36a4023223f5) | ![Screenshot from 2024-10-28 11-17-24](https://github.com/user-attachments/assets/9d0d9633-b857-45b4-9217-7d0d1aa8f770) | r? ```@notriddle```
2024-10-28rustdoc: Use accessors to interrogate type layoutsJubilee Young-4/+4
2024-10-28Unify variant struct fields margins with struct fieldsGuillaume Gomez-1/+1
2024-10-26Rollup merge of #132192 - petrochenkov:macfa, r=compiler-errorsJubilee-5/+3
expand: Stop using artificial `ast::Item` for macros loaded from metadata You don't need a full `Item` for that, and not using a piece of AST helps with https://github.com/rust-lang/rust/pull/131808.
2024-10-26Rollup merge of #132183 - GuillaumeGomez:code-in-docblock, r=notriddleJubilee-1/+1
Fix code HTML items making big blocks if too long Encountered this bug randomly where `code` item in docblocks would look like this: ![Screenshot from 2024-10-26 15-44-46](https://github.com/user-attachments/assets/a9c1df9d-5007-49eb-a7dd-a2c381b2511e) With this fix it looks like this: ![image](https://github.com/user-attachments/assets/ea918595-5434-4781-b68c-6abd38689365) r? ``@notriddle``
2024-10-26Rollup merge of #132123 - lolbinarycat:rustdoc-search-foreign-func, r=notriddleJubilee-1/+4
allow type-based search on foreign functions fixes https://github.com/rust-lang/rust/issues/131804 preferably will be merged after #129708, but that may take a while to be approved due to being a new feature, whereas this is definitely a bug, and should be fixed.
2024-10-26expand: Stop using artificial `ast::Item` for macros loaded from metadataVadim Petrochenkov-5/+3
2024-10-26Fix code HTML items making big blocks if too longGuillaume Gomez-1/+1
2024-10-25Re-do recursive const stability checksRalf Jung-1/+3
Fundamentally, we have *three* disjoint categories of functions: 1. const-stable functions 2. private/unstable functions that are meant to be callable from const-stable functions 3. functions that can make use of unstable const features This PR implements the following system: - `#[rustc_const_stable]` puts functions in the first category. It may only be applied to `#[stable]` functions. - `#[rustc_const_unstable]` by default puts functions in the third category. The new attribute `#[rustc_const_stable_indirect]` can be added to such a function to move it into the second category. - `const fn` without a const stability marker are in the second category if they are still unstable. They automatically inherit the feature gate for regular calls, it can now also be used for const-calls. Also, several holes in recursive const stability checking are being closed. There's still one potential hole that is hard to avoid, which is when MIR building automatically inserts calls to a particular function in stable functions -- which happens in the panic machinery. Those need to *not* be `rustc_const_unstable` (or manually get a `rustc_const_stable_indirect`) to be sure they follow recursive const stability. But that's a fairly rare and special case so IMO it's fine. The net effect of this is that a `#[unstable]` or unmarked function can be constified simply by marking it as `const fn`, and it will then be const-callable from stable `const fn` and subject to recursive const stability requirements. If it is publicly reachable (which implies it cannot be unmarked), it will be const-unstable under the same feature gate. Only if the function ever becomes `#[stable]` does it need a `#[rustc_const_unstable]` or `#[rustc_const_stable]` marker to decide if this should also imply const-stability. Adding `#[rustc_const_unstable]` is only needed for (a) functions that need to use unstable const lang features (including intrinsics), or (b) `#[stable]` functions that are not yet intended to be const-stable. Adding `#[rustc_const_stable]` is only needed for functions that are actually meant to be directly callable from stable const code. `#[rustc_const_stable_indirect]` is used to mark intrinsics as const-callable and for `#[rustc_const_unstable]` functions that are actually called from other, exposed-on-stable `const fn`. No other attributes are required.
2024-10-25allow type-based search on foreign functionsbinarycat-1/+4
fixes https://github.com/rust-lang/rust/issues/131804
2024-10-24Rollup merge of #132115 - bash:rustdoc-fake-variadic-wrapper, ↵Jubilee-0/+18
r=GuillaumeGomez,notriddle rustdoc: Extend fake_variadic to "wrapped" tuples This allows impls such as `impl QueryData for OneOf<(T,)>` to be displayed as variadic: `impl QueryData for OneOf<(T₁, T₂, …, Tₙ)>`. See question on [zulip](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Make.20.60.23.5Bdoc.28fake_variadic.29.5D.60.20more.20useful).
2024-10-24rustdoc: Extend fake_variadic to "wrapped" tuplesTau Gärtli-0/+18
This allows impls such as `impl QueryData for OneOf<(T,)>` to be displayed as variadic: `impl QueryData for OneOf<(T₁, T₂, …, Tₙ)>`. See question on zulip: <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Make.20.60.23.5Bdoc.28fake_variadic.29.5D.60.20more.20useful>
2024-10-24Rollup merge of #131906 - notriddle:notriddle/spacing, r=GuillaumeGomezMatthias Krüger-5/+11
rustdoc: adjust spacing and typography in header Fixes #131589 Preview: https://notriddle.com/rustdoc-html-demo-12/spacing/std/index.html | Before | After | |--|--| | ![image](https://github.com/user-attachments/assets/b5c5132d-1e5e-402e-ba19-1dea9e70ea6f) | ![image](https://github.com/user-attachments/assets/72570b93-bb16-4553-9da7-fc4f29b98873) | ![image](https://github.com/user-attachments/assets/264983f0-5aec-4120-8a03-f62e52d4360d) | ![image](https://github.com/user-attachments/assets/b6925945-95e6-4858-8e91-4cfd90c164f0) | ![image](https://github.com/user-attachments/assets/df96bfe7-195d-4aaf-97f1-a45ade34cab2) | ![image](https://github.com/user-attachments/assets/c6fe2d57-bd8a-42aa-b3cf-4f635809b9b4) | ![image](https://github.com/user-attachments/assets/7519faa5-d6b2-41ba-9d95-6000d1dd89d1) | ![image](https://github.com/user-attachments/assets/7233c2d6-82d9-4820-bb63-dc4776a34601) First of all, we put 4px additional margin below the search box, and 4px margin below the header to balance it out. The bigger problem we have to solve is making the lines look logically spaced. This is troublesome, because Fira Sans (the typeface we use here) wants to look good on average, and to avoid breaking, with text that uses [ascenders and descenders](https://www.w3.org/TR/css-inline-3/images/text-edge.png). If the text we're putting in happens to not have any, things look weird (strictly speaking, there’s hand-tuning here, because the Copy Path button messes with stuff, but the overall point is that there is no true, one perfect layout). In order to play nicely with the font, I've tweaked the text to use that space. The word "Source" for the link is now capitalized, and the Since version number now uses oldstyle nums with descenders.
2024-10-24Auto merge of #131951 - notriddle:notriddle/sha256-compile-time, ↵bors-13/+6
r=GuillaumeGomez rustdoc: hash assets at rustdoc build time Since sha256 is slow enough to show up on small benchmarks, we can save time by embedding the hash in the executable. Addresses https://github.com/rust-lang/rust/pull/131934#issuecomment-2424213861
2024-10-23rustdoc: adjust spacing and typography in headerMichael Howell-5/+11
2024-10-23Rollup merge of #131928 - aDotInTheVoid:wait-we-support-this, r=GuillaumeGomezLeón Orell Valerian Liehr-1/+1
rustdoc: Document `markdown` module. Rustdoc markdown handling is currently split between: - html::markdown, which contains all the meaty login - markdown, which is only used for when rustdoc renders a standalone markdown file Adds module-level doc-comment to markdown, and rename the function so it's clear that it's doing IO (instead of just rendering to a string).
2024-10-22Represent TraitBoundModifiers as distinct parts in HIRMichael Goulet-7/+7
2024-10-20Rollup merge of #131945 - aDotInTheVoid:footnote-time, r=notriddleStuart Cook-79/+118
rustdoc: Clean up footnote handling Best reviewed commit by commit. Extracts footnote handling logic into it's own file (first commit) and then makes that file slightly nicer to read/understand. No functional changes, but lays the groundwork for making more changes to footnotes (eg #131901, #131946)
2024-10-19rustdoc: hash assets at rustdoc build timeMichael Howell-13/+6
Since sha256 is slow enough to show up on small benchmarks, we can save time by embedding the hash in the executable.
2024-10-19rustdoc: Refractor footnote handlingAlona Enraght-Moony-36/+67
2024-10-19rustdoc: Extract footnote logic into it's own module.Alona Enraght-Moony-79/+87
2024-10-19rustdoc: Document `markdown` module.Alona Enraght-Moony-1/+1
Rustdoc markdown handling is currently split between: - html::markdown, which contains all the meaty login - markdown, which is only used for when rustdoc renders a standalone markdown file Adds module-level doc-comment to markdown, and rename the function so it's clear that it's doing IO (instead of just rendering to a string).
2024-10-19rustdoc: Switch from FxHash to sha256 for static file hashing.Alona Enraght-Moony-15/+14
2024-10-16rustdoc: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-10/+12
2024-10-11Rollup merge of #131394 - ↵Matthias Krüger-0/+3
ismailarilik:fix/rustdoc/add-space-between-struct-fields-and-their-descriptions, r=GuillaumeGomez fix(rustdoc): add space between struct fields and their descriptions Stolen from #128541. Fixes #128260. <table> <thead> <tr> <th scope="col">Before</th> <th scope="col">After</th> </tr> </thead> <tbody> <tr> <td scope="row"> <img src="https://github.com/user-attachments/assets/b1d3cb47-77c9-4897-a5d2-2192b11cb8a3" /> </td> <td> <img src="https://github.com/user-attachments/assets/0b104672-d2be-49f4-ac9b-3506526fe2f1" /> </td> </tr> </tbody> </table> <table> <thead> <tr> <th scope="col">Before</th> <th scope="col">After</th> </tr> </thead> <tbody> <tr> <td scope="row"> <img src="https://github.com/user-attachments/assets/650c3e74-a067-492a-9ba3-557f9214f875" /> </td> <td> <img src="https://github.com/user-attachments/assets/413ef9b0-8fca-4e16-978a-7b88d05299dc" /> </td> </tr> </tbody> </table> Unlike original PR, I didn't add space between field headers; I put it between headers and descriptions. So if there are only headers, the space is not changed. Otherwise, I put a space like the space between paragraphs (.75em) which makes sense for me but feel free to adjust it or ask me to do so. r? `@GuillaumeGomez`
2024-10-09Rollup merge of #131417 - GuillaumeGomez:mobile-methods-left-margin, r=notriddleMatthias Krüger-1/+1
Fix methods alignment on mobile I realized that on mobile, the methods are not aligned the same depending if they have documentation or not: | before | after | |-|-| | ![Screenshot from 2024-10-08 20-40-22](https://github.com/user-attachments/assets/d31ba5e1-cf84-431f-9b2b-9962bc5a0365) | ![image](https://github.com/user-attachments/assets/ffde2161-bfcb-4462-8c5b-88538e61b366) | r? `@notriddle`
2024-10-09Fix methods alignment on mobileGuillaume Gomez-1/+1
2024-10-08Reserve guarded string literals (RFC 3593)Peter Jaszkowiak-0/+1
2024-10-08fix(rustdoc): add space between struct fields and their descriptionsismailarilik-0/+3
2024-10-08Auto merge of #131368 - GuillaumeGomez:rustdoc-dead-code, r=notriddlebors-48/+1
[rustdoc] Remove intra-doc links dead code While working on https://github.com/rust-lang/rust/pull/130278, I wondered what `resolve_display_text` was doing. I removed it and ran all rustdoc tests, and nothing failed. Are some intra-doc links tests missing or is it really dead code? Couldn't figure it out. r? `@notriddle`
2024-10-07Add comment to describe camelcase line breakMichael Howell-0/+10
2024-10-07rustdoc: improve `<wbr>`-insertion for SCREAMING_CAMEL_CASEMichael Howell-1/+5
2024-10-07Remove dead codeGuillaume Gomez-48/+1
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-54/+54
2024-10-05Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errorsbors-1/+0
Make opaque types regular HIR nodes Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead. I haven't gone through all the test changes yet, so there may be a few surprises. Many thanks to `@camelid` for the first draft. Fixes https://github.com/rust-lang/rust/issues/129023 Fixes #129099 Fixes #125843 Fixes #119716 Fixes #121422
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-1/+0
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-04Fix list marginsGuillaume Gomez-3/+6
2024-10-01Rollup merge of #130933 - lolbinarycat:rustdoc-li-p, r=GuillaumeGomez,notriddleMatthias Krüger-0/+7
rustdoc: lists items that contain multiple paragraphs are more clear fixes https://github.com/rust-lang/rust/issues/130622 before: ![before](https://github.com/user-attachments/assets/fe54d8ee-8a1a-45fc-9434-2737c5c6f4d5) after: ![after](https://github.com/user-attachments/assets/095be365-1bfc-4001-8664-59bc4125bb05)
2024-10-01Auto merge of #131076 - lukas-code:doc-stab2, r=notriddlebors-19/+12
rustdoc: rewrite stability inheritance as a doc pass Since doc inlining can almost arbitrarily change the module hierarchy, we can't just use the HIR ancestors of an item to compute its effective stability. This PR moves the stability inheritance that I implemented in https://github.com/rust-lang/rust/pull/130798 into a new doc pass `propagate-stability` that runs after doc inlining and uses the post-inlining ancestors of an item to correctly compute its effective stability. fixes https://github.com/rust-lang/rust/issues/131020 r? `@notriddle`
2024-09-30rustdoc: rewrite stability inheritance as a passLukas Markeffsky-19/+12