about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-01-13librustdoc: Address some clippy lintspierwill-8/+6
Also ignore clippy's "collapsible if..." lints.
2022-01-13rustdoc: decouple stability and const-stabilityAndy Russell-36/+55
2022-01-13Regenerate the PNGs favicon with the updated Rust logoLoïc BRANSTETT-0/+0
2022-01-13Use the updated Rust logo and change it's format to SVGLoïc BRANSTETT-3/+65
2022-01-13Rollup merge of #91687 - euclio:tuple-variant-field-section, r=GuillaumeGomezMatthias Krüger-5/+14
rustdoc: do not emit tuple variant fields if none are documented Fixes #90824. Before: ![2021-12-15T22:26:41](https://user-images.githubusercontent.com/1372438/146302871-4d265433-b9aa-4e53-adfb-e7cb92107180.png) After: ![2021-12-15T22:27:01](https://user-images.githubusercontent.com/1372438/146302872-e39eda3d-2fb2-4fb9-aae7-2008e4e1b4dd.png)
2022-01-13Auto merge of #92526 - djc:rustdoc-askama, r=jshabors-270/+15
Migrate rustdoc from Tera to Askama See #84419. Should probably get a benchmarking run to verify if it has the intended effect on rustdoc performance. cc `@jsha` `@jyn514.`
2022-01-12Rollup merge of #92764 - GuillaumeGomez:fix-rust-logo-style, r=jshaMatthias Krüger-3/+3
Fix rust logo style The style on the rust logo is currently broken: ![Screenshot from 2022-01-11 13-36-30](https://user-images.githubusercontent.com/3050060/148946754-a1a57253-bed0-44cf-a41c-83e0eecbd6b5.png) With this fix, we're back to normal: ![Screenshot from 2022-01-11 13-42-07](https://user-images.githubusercontent.com/3050060/148946778-99f44678-aac1-419f-bb8c-ffa837e0c1ee.png) I also used a GUI test to prevent future silent regressions. r? ```@jsha```
2022-01-12Rollup merge of #92742 - GuillaumeGomez:missing-suffix-sidebar-items, ↵Matthias Krüger-2/+6
r=notriddle Add missing suffix for sidebar-items script path Fixes https://github.com/rust-lang/docs.rs/issues/1590. r? ```@syphar```
2022-01-12Rollup merge of #92699 - camelid:private-fields, r=jshaMatthias Krüger-5/+3
rustdoc: Display "private fields" instead of "fields omitted" Also: * Always use `/* */` block comments * Use the same message everywhere, rather than sometimes prefixing with "some" When I first read rustdoc docs, I was confused why the fields were being omitted. It was only later that I realized it was because they were private. It's also always bothered me that rustdoc sometimes uses `//` and sometimes uses `/*` comments for these messages, so this change makes them all use `/*`. Technically, I think fields can be omitted if they are public but `doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's really just used to emulate "doc privacy" when -- because of technical limitations -- an item has to be public. So I think it's fine to include this under the category of "private fields". r? ```@jsha```
2022-01-11rustdoc: do not emit tuple variant fields if none are documentedAndy Russell-5/+14
2022-01-11Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`Aaron Hill-2/+2
The field is also renamed from `ident` to `name. In most cases, we don't actually need the `Span`. A new `ident` method is added to `VariantDef` and `FieldDef`, which constructs the full `Ident` using `tcx.def_ident_span()`. This method is used in the cases where we actually need an `Ident`. This makes incremental compilation properly track changes to the `Span`, without all of the invalidations caused by storing a `Span` directly via an `Ident`.
2022-01-11Fix style for rust logoGuillaume Gomez-3/+3
2022-01-10Add missing suffix for sidebar-items script pathGuillaume Gomez-2/+6
2022-01-10Remove configuration which became unused in ↵Dirkjan Ochtman-5/+0
8abb4bb698c9d74507adb9cd7b54a032f3c1b595
2022-01-10Address feedbackDirkjan Ochtman-7/+3
2022-01-10Migrate rustdoc from Tera to AskamaDirkjan Ochtman-260/+14
See #84419.
2022-01-10Rollup merge of #92602 - jsha:source-link-2, r=GuillaumeGomezMatthias Krüger-52/+62
Make source links look cleaner Change from syntaxy-looking [src] to the plain word "source". Change the syntaxy-looking `[-]` at the top of the page to say "collapse". Reduce opacity of rightside content. Part of #59851 r? `@GuillaumeGomez` Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/display.20of.20source.20link).
2022-01-09Display "private fields" instead of "fields omitted"Noah Lev-5/+3
Also: * Always use `/* */` block comments * Use the same message everywhere, rather than sometimes prefixing with "some" When I first read rustdoc docs, I was confused why the fields were being omitted. It was only later that I realized it was because they were private. It's also always bothered me that rustdoc sometimes uses `//` and sometimes uses `/*` comments for these messages, so this change makes them all use `/*`. Technically, I think fields can be omitted if they are public but `doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's really just used to emulate "doc privacy" when -- because of technical limitations -- an item has to be public. So I think it's fine to include this under the category of "private fields".
2022-01-09Rollup merge of #92673 - GuillaumeGomez:remove-all-items-toggle, r=jshaMatthias Krüger-8/+0
Remove useless collapse toggle on "all items" page When clicking on this toggle, nothing happens because there is nothing to collapse. Instead of keeping it around, let's just remove it. Before: ![Screenshot from 2022-01-08 16-02-38](https://user-images.githubusercontent.com/3050060/148649149-821a1e77-8c34-4975-b50a-984ca8865518.png) After: ![Screenshot from 2022-01-08 16-02-32](https://user-images.githubusercontent.com/3050060/148649154-b5912a97-9229-46bd-be3c-df3c3fa3ac8f.png) r? `@jsha`
2022-01-09Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomezMatthias Krüger-28/+35
Move crate drop-down to search results page This reduces clutter on doc pages. Part of #59840 r? ```@GuillaumeGomez``` Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str
2022-01-08Remove useless collapse toggle on "all items" pageGuillaume Gomez-8/+0
2022-01-08Make source links look cleanerJacob Hoffman-Andrews-52/+62
Change from syntaxy-looking [src] to the plain word "source".
2022-01-07Rollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, ↵Eric Huss-2/+6
r=jsha Create CSS class instead of using inline style for search results I saw this change in the update you proposed in https://github.com/rust-lang/rust/pull/92404. :) r? ``@jsha``
2022-01-06Create CSS class instead of using inline style for search resultsGuillaume Gomez-2/+6
2022-01-06Rollup merge of #92404 - GuillaumeGomez:src-font-size, r=jshaMatthias Krüger-13/+7
Fix font size for [src] links in headers Fixes #90384. cc `@jsha` r? `@camelid`
2022-01-06Rollup merge of #92058 - jsha:run-on-hover, r=GuillaumeGomezMatthias Krüger-1/+4
Make Run button visible on hover This slightly reduces the noisiness of doc pages, making them easier to read. Demo: https://rustdoc.crud.net/jsha/run-on-hover/std/string/struct.String.html [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.22Run.22.20button.20visible.20on.20hover). Part of #59845
2022-01-05Simplify :target CSS selectorGuillaume Gomez-12/+3
2022-01-05Move crate drop-down to search results pageJacob Hoffman-Andrews-28/+35
This reduces clutter on doc pages.
2022-01-05Fix font size for [src] links in headersGuillaume Gomez-1/+4
2022-01-05Make Run button visible on hoverJacob Hoffman-Andrews-1/+4
This slightly reduces the noisiness of doc pages, making them easier to read.
2022-01-02Set font size proportional to user's font sizeJacob Hoffman-Andrews-53/+58
According to MDN (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size), > To maximize accessibility, it is generally best to use values that > are relative to the user's default font size. > Defining font sizes in px is not accessible, because the user cannot > change the font size in some browsers. Note that changing font size (in browser or OS settings) is distinct from the zoom functionality triggered with Ctrl/Cmd-+. Zoom functionality increases the size of everything on the page, effectively applying a multiplier to all pixel sizes. Font size changes apply to just text. For relative font sizes, we could use `em`, as we do in several places already. However that has a problem of "compounding" (see MDN article for details). The compounding problem is nicely solved by `rem`, which make font sizes relative to the root element, not the parent element. Since we were using a hodge-podge of pixel sizes, em, rem, and percentage sizes before, this change switching everything to rem, while keeping the same size relative to our old default of 16px. 16px is still the default on most browsers, for users that haven't set a larger or smaller font size.
2021-12-31Rollup merge of #92440 - GuillaumeGomez:fix-mobile-toggles, r=jshaMatthias Krüger-0/+10
Fix mobile toggles position Before: ![Screenshot from 2021-12-29 18-53-33](https://user-images.githubusercontent.com/3050060/147764842-082f6fa2-b631-4c47-ba34-ced76fe8494f.png) After: ![Screenshot from 2021-12-29 18-52-48](https://user-images.githubusercontent.com/3050060/147764853-13046330-2442-4fad-b26a-84c167711b54.png) r? `@jsha`
2021-12-31Rollup merge of #91480 - jsha:fewer-colors, r=GuillaumeGomezMatthias Krüger-61/+75
rustdoc: use smaller number of colors to distinguish items This reduces visual distractions when reading method signatures. As discussed in https://github.com/rust-lang/rust/issues/59845#issuecomment-974757191, this categorizes items into one of six colors (down from thirteen): - method, function (ochre `#AD7C37`) - trait, trait alias (dark slate blue `#6E4FC9`) - enum, struct, type alias, union, primitive (maroon `#AD378A`) - static, module, keyword, associated type, foreign type (steel blue `#3873AD`) - macro (green `#068000`) - generic params, self, Self (unmarked black `#000000`) I slightly tweaked the actual color values so they'd have the same lightness (previously the trait color stood out much more than the others). And I made the color for links in general consistently use steel blue (previously there was a slightly different color for "search-failed"). The ayu and dark themes have been updated according to the same logic. I haven't changed any of the color values in those themes, just their assignment to types. Demo: https://rustdoc.crud.net/jsha/fewer-colors/std/string/struct.String.html https://rustdoc.crud.net/jsha/fewer-colors/std/vec/struct.Vec.html https://rustdoc.crud.net/jsha/fewer-colors/std/io/trait.Read.html https://rustdoc.crud.net/jsha/fewer-colors/std/iter/trait.Iterator.html
2021-12-31Auto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednetbors-8/+9
Update pulldown-cmark version to 0.9 Fixes https://github.com/rust-lang/rust/issues/92206. r? `@camelid`
2021-12-30Fix display of toggles on mobileGuillaume Gomez-0/+10
2021-12-30Auto merge of #92377 - compiler-errors:rustdoc-lifetimes, r=camelid,jyn514bors-5/+5
remove in_band_lifetimes from librustdoc r? `@camelid` closes #92368
2021-12-29Rollup merge of #92340 - camelid:search-index-cleanup, r=GuillaumeGomezMatthias Krüger-44/+40
rustdoc: Start cleaning up search index generation I'm trying to simplify and clean up the code, partly to make #90779 easier. r? `@GuillaumeGomez`
2021-12-29Auto merge of #92283 - vacuus:print-generic-bounds, r=camelid,GuillaumeGomezbors-3/+1
rustdoc: Remove `String` allocation in iteration in `print_generic_bounds` (I realized only after making the commit that maybe I shouldn't refer to iteration as looping, but it's close enough) The string representation of a `clean::GenericBound` instance (evaluated [here](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/format.rs#L397)) is deterministic for a given `self` (the instance), `cx` and `f`, and since `cx` and `f` are constant (as far as I can tell) for a given invocation of `print_generic_bounds`, `self` is the determining factor. Therefore, using the data in `self` shouldn't differ in effect from using its string representation. Given the totality of the function calls needed to evaluate the string representation as well as the actual allocation, at the very least, this shouldn't negatively affect performance.
2021-12-28remove in_band_lifetimes from librustdocMichael Goulet-5/+5
2021-12-28Add regression test for #59502Noah Lev-0/+2
This issue was fixed using a hacky recursion "fuel" argument, but the issue was never minimized nor was a regression test added. The underlying bug is still unfixed, so this test should help with fixing it and removing the `recurse` hack.
2021-12-28Remove unused parameterNoah Lev-6/+5
2021-12-28Update pulldown-cmark version to 0.9Guillaume Gomez-8/+9
2021-12-27Give clearer names to several search index functionsNoah Lev-12/+24
2021-12-27Coalesce two arguments as `&Function`Noah Lev-6/+8
2021-12-27Make `search_index` functions private where possibleNoah Lev-2/+2
Now the only two crate-public items are `build_index` and `get_index_search_type` (because for some reason the latter is also used in `formats::cache`).
2021-12-27Move `ExternalLocation` to `clean::types`Noah Lev-14/+6
It was previously defined in `render::search_index` but wasn't used at all there. `clean::types` seems like a better fit since that's where `ExternalCrate` is defined.
2021-12-27rustdoc: Remove some unnecessary `cache` parametersNoah Lev-23/+12
Based on https://github.com/rust-lang/rust/pull/80883#issuecomment-774437832. The `tcx` parameters do seem to be used though, so I only removed the `cache` parameters.
2021-12-27Rename `rustdoc::html::render::cache` to `search_index`Noah Lev-3/+3
The old name wasn't very clear, while the new one makes it clear that this is the code responsible for creating the search index.
2021-12-25Remove unneeded call to `collect`Roc Yu-5/+6
2021-12-25Remove `String` allocation in loopRoc Yu-3/+1