summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2023-07-01Put `LayoutError` behind reference to shrink resultNilstrieb-1/+1
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's shrink that.
2023-06-23Rollup merge of #112927 - GuillaumeGomez:where-clause-indent, r=notriddleMatthias Krüger-2/+2
Fix indentation for where clause in rustdoc pages Screenshot of the bug: ![image](https://github.com/rust-lang/rust/assets/3050060/090cfeaa-0edc-46c7-9ea0-e26ac865b2c2) I used this opportunity to clarify the code a bit because some weird things were going on. r? ````@notriddle````
2023-06-22Fix indentation for where clause in rustdoc pagesGuillaume Gomez-2/+2
2023-06-22Rollup merge of #112906 - ↵Matthias Krüger-1/+2
fmease:rustdoc-render-assoc-ty-body-before-where-clause, r=notriddle rustdoc: render the body of associated types before the where-clause Fixes #112903.
2023-06-21rustdoc: render the assoc ty body before the where-clauseLeón Orell Valerian Liehr-1/+2
2023-06-21Rollup merge of #112894 - GuillaumeGomez:gui-fields-display, r=notriddleGuillaume Gomez-3/+2
Fix union fields display ![Screenshot from 2023-06-21 16-47-24](https://github.com/rust-lang/rust/assets/3050060/833b0fe6-7fb6-4371-86c3-d82fa0c3fe49) So two bugs in this screenshot: no whitespace between field name and type name, both fields are on the same line. Both problems come from issues in the templates because all whitespace are removed if a askama "command" follows. r? `@notriddle`
2023-06-21Fix union fields displayGuillaume Gomez-3/+2
2023-06-20Fix invalid creation of files in rustdocGuillaume Gomez-7/+34
2023-06-13Fix URL encoding of % sign in Rust Doc.TumoiYorozu-2/+0
2023-06-12Revert "List matching impls on type aliases"Guillaume Gomez-110/+28
This reverts commit 4b1d13d9841c815915433ca2a3088a8e3e97ad96.
2023-06-11Add `item_template` macroNicky Lim-57/+116
2023-06-09List matching impls on type aliasesGuillaume Gomez-28/+110
2023-06-08Rollup merge of #112034 - sladyn98:migrate-opaque-ty, r=GuillaumeGomezGuillaume Gomez-3/+10
Migrate `item_opaque_ty` to Askama This PR migrates `item_opaque_ty` to Askama Refers: https://github.com/rust-lang/rust/issues/108868
2023-06-08Migrate item_opaque_type to Askamasladynnunes-3/+10
Migrate item_opaque_type to Askama Fix wrap_item parameters Fix to write
2023-06-05Rollup merge of #112243 - GuillaumeGomez:rm-unneeded-buffer-creations, ↵Guillaume Gomez-24/+19
r=notriddle Remove unneeded `Buffer` allocations when `&mut fmt::Write` can be used directly With the recent changes, `wrap_item` can now directly take `&mut Write`, which makes some `Buffer` creations unneeded. r? `@notriddle`
2023-06-05Move write! arguments directly into the stringGuillaume Gomez-6/+6
2023-06-05Auto merge of #110945 - wackbyte:doc-vis-on-inherent-assoc-types, r=jshabors-1/+3
rustdoc: render visibility on associated types This should only affect inherent associated types (#8995).
2023-06-03Remove unneeded `Buffer` allocations when `&mut fmt::Write` can be used directlyGuillaume Gomez-23/+18
2023-06-03Auto merge of #112032 - sladyn98:migrate-item-primitive, r=GuillaumeGomezbors-3/+3
Migrate `item_primitive` to Askama This PR migrates `item_primitive` to Askama Refers https://github.com/rust-lang/rust/issues/108868
2023-06-01Rollup merge of #112030 - sladyn98:item-trait-alias, r=GuillaumeGomezMichael Goulet-8/+15
Migrate `item_trait_alias` to Askama This PR migrates `item_trait_alias` to Askama Refers https://github.com/rust-lang/rust/issues/108868
2023-06-01Migrate to Askamasladynnunes-8/+15
Implemented wrap_item_write Update wrap_item
2023-05-31Rollup merge of #112113 - notriddle:notriddle/rm-fnretty, r=GuillaumeGomezMatthias Krüger-21/+12
rustdoc: simplify `clean` by removing `FnRetTy` The default fn ret ty is always unit. Just use that. Looking back at the time when `FnRetTy` (then called `FunctionRetTy`) was first added to rustdoc, it seems to originally be there because `-> !` was a special form: the never type didn't exist back then. https://github.com/rust-lang/rust/commit/eb01b17b06eb35542bb80ff7456043b0ed5572ba#diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9L921-L924 `DefaultReturn` was later added to rustdoc to mirror a change in HIR, which added a variant for DefaultReturn because it makes `Span` management easier. This isn't needed in rustdoc, since it doesn't carry spans. https://github.com/rust-lang/rust/commit/3f0cc8011aef3f530663302d525bd2d8cb493db5#diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9R1144
2023-05-31Rollup merge of #112031 - sladyn98:migrate-proc-macro, r=GuillaumeGomezMatthias Krüger-10/+16
Migrate `item_proc_macro` to Askama This PR migrates `item_proc_macro` to Askama Refers https://github.com/rust-lang/rust/issues/108868
2023-05-30rustdoc: simplify `clean` by removing `FnRetTy`Michael Howell-21/+12
The default fn ret ty is always unit. Just use that. Looking back at the time when `FnRetTy` (then called `FunctionRetTy`) was first added to rustdoc, it seems to originally be there because `-> !` was a special form: the never type didn't exist back then. https://github.com/rust-lang/rust/commit/eb01b17b06eb35542bb80ff7456043b0ed5572ba#diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9L921-L924
2023-05-28Migrate to Askamasladynnunes-3/+3
2023-05-28Migrate to Askamasladynnunes-10/+16
2023-05-28Rollup merge of #112005 - sladyn98:item-foreign-types, r=GuillaumeGomezfee1-dead-6/+8
Migrate `item_foreign_type` to Askama This PR continues the migration of `print_item.rs` functions to Askama. This piece of work migrates the function `item_foreign_type` Refers https://github.com/rust-lang/rust/issues/108868
2023-05-27Migrate to Askamasladynnunes-6/+8
Fix formatting Fix CI
2023-05-27Rollup merge of #112018 - GuillaumeGomez:cleanup-tcx, r=notriddleMatthias Krüger-11/+10
Clean up usage of `cx.tcx` when `tcx` is already set into a variable I discovered a few cases where `cx.tcx` (and equivalents) was used whereas `tcx` was already stored into a variable. In those cases, better to just use `tcx` directly. r? `@notriddle`
2023-05-27Rollup merge of #111946 - nicklimmm:askama-item-template-trait, r=GuillaumeGomezMatthias Krüger-38/+57
rustdoc: Add `ItemTemplate` trait and related functions to avoid repetitively wrapping existing functions Context: https://github.com/rust-lang/rust/pull/111430#discussion_r1200672507 This trait will be used extensively in performing migrations to Askama templates (tracking issue: https://github.com/rust-lang/rust/issues/108868)
2023-05-27Clean up usage of `cx.tcx` when `tcx` is already set into a variableGuillaume Gomez-11/+10
2023-05-27Rollup merge of #111927 - sladyn98:item-static, r=GuillaumeGomezMatthias Krüger-5/+9
Migrate `item_static` to Askama This pull request addresses the type signature of the item_static function in our codebase. Previously, this function accepted a mutable reference to a Buffer for writing output. The current changes modify this to instead accept a mutable reference to any type that implements the Write trait. Referes https://github.com/rust-lang/rust/issues/108868
2023-05-26Formatted file correctlysladynnunes-1/+0
2023-05-26Fixed testssladynnunes-4/+9
2023-05-26Fix failing CIsladynnunes-1/+1
2023-05-25Add `ItemTemplate` traitNicky Lim-38/+57
2023-05-24Migrate item_static to Askamasladynnunes-1/+1
2023-05-22rustdoc: Cleanup doc string collapsingVadim Petrochenkov-19/+13
2023-05-17Add missing backslash in HTML stringGuillaume Gomez-1/+1
2023-05-08Rollup merge of #109410 - fmease:iat-alias-kind-inherent, r=compiler-errorsMichael Goulet-1/+3
Introduce `AliasKind::Inherent` for inherent associated types Allows us to check (possibly generic) inherent associated types for well-formedness. Type inference now also works properly. Follow-up to #105961. Supersedes #108430. Fixes #106722. Fixes #108957. Fixes #109768. Fixes #109789. Fixes #109790. ~Not to be merged before #108860 (`AliasKind::Weak`).~ CC `@jackh726` r? `@compiler-errors` `@rustbot` label T-types F-inherent_associated_types
2023-05-06Rollup merge of #110780 - notriddle:notriddle/slice-index, r=GuillaumeGomezYuki Okushi-2/+28
rustdoc-search: add slices and arrays to index This indexes them as primitives with generics, so `slice<u32>` is how you search for `[u32]`, and `array<u32>` for `[u32; 1]`. A future commit will desugar the square bracket syntax to search both arrays and slices at once.
2023-05-04IAT: Rustdoc integrationLeón Orell Valerian Liehr-1/+3
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-3/+2
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-04-30Rollup merge of #110983 - GuillaumeGomez:foreign-repr, r=notriddleMatthias Krüger-42/+21
rustdoc: Get `repr` information through `AdtDef` for foreign items As suggested by `@notriddle,` this approach works too. The only downside is that the display of the original attribute isn't kept, but I think it's an acceptable downside. r? `@notriddle`
2023-04-29Unify attributes retrieval for JSON and HTML renderingGuillaume Gomez-73/+2
2023-04-29Fix display of attributes for enumsGuillaume Gomez-2/+2
2023-04-29Get `repr` information through `AdtDef` for foreign itemsGuillaume Gomez-21/+71
2023-04-28rustdoc: fix weird margins between Deref impl itemsMichael Howell-6/+12
In the old setup, if the dereffed-to item has multiple impl blocks, each one gets its own `div.impl-items` in the section, but there are no headers separating them. Since the last method in a `div.impl-items` has no bottom margin, and there are no margins between these divs, there is no margin between the last method of one impl and the first method of the following impl. This patch fixes it by simplifying the HTML. Each Deref block gets exactly one `div.impl-items`, no matter how many impl blocks it actually has.
2023-04-28rustdoc: render visibility on associated typeswackbyte-1/+3
This should only affect inherent associated types.
2023-04-24rustdoc-search: add slices and arrays to indexMichael Howell-2/+28
This indexes them as primitives with generics, so `slice<u32>` is how you search for `[u32]`, and `array<u32>` for `[u32; 1]`. A future commit will desugar the square bracket syntax to search both arrays and slices at once.