about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-08-28Fix code blocks color in ayu themeGuillaume Gomez-1/+1
2021-08-27Introduce `~const`Deadbeef-1/+1
- [x] Removed `?const` and change uses of `?const` - [x] Added `~const` to the AST. It is gated behind const_trait_impl. - [x] Validate `~const` in ast_validation. - [ ] Add enum `BoundConstness` to the HIR. (With variants `NotConst` and `ConstIfConst` allowing future extensions) - [ ] Adjust trait selection and pre-existing code to use `BoundConstness`. - [ ] Optional steps (*for this PR, obviously*) - [ ] Fix #88155 - [ ] Do something with constness bounds in chalk
2021-08-26Remove unnecessary copies when using parallel IOJoshua Nelson-39/+47
Previously, rustdoc was making lots of copies of temporary owned values. Now, it uses the owned value wherever possible.
2021-08-26Auto merge of #88222 - jyn514:shared-cache, r=GuillaumeGomezbors-49/+38
rustdoc: Move Cache from Context to SharedContext r? `@camelid`
2021-08-25Don't panic if `close_tag()` is called without tags to closeNoah Lev-3/+14
This can happen when a tag is opened after the length limit is reached; the tag will not end up being added to `unclosed_tags` because the queue will never be flushed. So, now, if the `unclosed_tags` stack is empty, `close_tag()` does nothing. This change fixes a panic in the `limit_0` unit test.
2021-08-25Assert that `tag_name` is alphabeticNoah Lev-0/+8
2021-08-25Add tests for `HtmlWithLimit`Noah Lev-0/+122
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-22Move Cache from Context to SharedContextJoshua Nelson-49/+38
2021-08-21Use `write!`Noah Lev-6/+2
2021-08-21Use the length limit as the initial capacityNoah Lev-2/+11
The length limit turns out to be a surprisingly good heuristic for initial allocation size. See here for more details [1]. [1]: https://github.com/rust-lang/rust/pull/88173#discussion_r692531631
2021-08-21Clarify wording in docsNoah Lev-1/+1
2021-08-19Refactor Markdown length-limited summary implementationNoah Lev-43/+124
This commit refactors the implementation of `markdown_summary_with_limit()`, separating the logic of determining when the limit has been reached from the actual rendering process. The main advantage of the new approach is that it guarantees that all HTML tags are closed, whereas the previous implementation could generate tags that were never closed. It also ensures that no empty tags are generated (e.g., `<em></em>`). The new implementation consists of a general-purpose struct `HtmlWithLimit` that manages the length-limiting logic and a function `markdown_summary_with_limit()` that renders Markdown to HTML using the struct.
2021-08-19Rollup merge of #88093 - Kobzol:rustdoc-wrap-code-in-code-tag, r=GuillaumeGomezGuillaume Gomez-266/+294
[rustdoc] Wrap code blocks in <code> tag This PR modifies Rustdoc output so that fenced code snippets, items and whole file source codes are wrapped in `<pre><code>` instead of just `<pre>`. This should improve the semantic meaning of the generated content. I'm not sure what to do about `render_attributes_in_pre` and `render_attributes_in_code`. These functions were clearly expected to be used for things inside `<pre>` or `<code>`, and since I added `<code>` in this PR, some of them will be used in a different context than before. However, it seems to me that even before they were not consistent. For example, `item_constant` used `render_attributes_in_code` for its attributes, however there was no `<code>` used for constants before this PR... Should I create some `rustdoc-gui` tests? For example to check that all `<pre>` tags have a `<code>` child? Fixes: https://github.com/rust-lang/rust/issues/88020
2021-08-19[rustdoc] Wrap code blocks in <code> tagJakub Beránek-266/+294
2021-08-18Rollup merge of #88111 - GuillaumeGomez:background-color-jump-to-def, r=jhprattGuillaume Gomez-0/+9
Add background-color on clickable definitions in source code Someone suggested to add a decoration on clickable elements in the source code pages: ![Screenshot from 2021-08-17 14-49-39](https://user-images.githubusercontent.com/3050060/129728911-def74f9e-50e2-40d2-b512-e23f1b3d0409.png) ![Screenshot from 2021-08-17 14-49-47](https://user-images.githubusercontent.com/3050060/129728925-14aec500-82ff-4336-955a-4173c769deeb.png) ![Screenshot from 2021-08-17 14-49-52](https://user-images.githubusercontent.com/3050060/129728927-a8a89d7a-e837-4ff5-b094-35be23629d14.png) The idea is to not disturb the reading while telling the reader "you can click on this one", which is why it's not a text decoration. What do you think `@rust-lang/rustdoc` ? r? `@Nemo157`
2021-08-18Fix anchors display in rustdocGuillaume Gomez-5/+9
2021-08-17Add background-color on clickable definitions in source codeGuillaume Gomez-0/+9
2021-08-16Rollup merge of #87178 - moxian:rd-use, r=jyn514Mara Bos-4/+3
[rustdoc] Copy only item path to clipboard rather than full `use` statement. The (somewhat) recent addition of the "copy item import to clipboard" button is extremely nice. However, i tend to write my code with fully qualified paths wherever feasible and only resort to `use` statements as a refactoring pass. This makes the "copy to clipboard" workflow awkward to use, as i would be copy-pasting that as, say ```rust impl use std::ops::Add; for MyType { ``` and then go back and remove the `use ` and `;`. This PR removes the `use ;` decorations, making it much nicer to use for fully-qualified items. I argue, however, that this does not noticeably degrade experience for those who prefer to import items, since the hard part about those is getting the path right, and writing the `use ;` decoration can be done by hand with little effort.
2021-08-12Updates favicon order of precedence as it matters to Chromeskim-2/+2
2021-08-08Fix heading colours in Ayu themeKlim Tsoutsman-1/+1
Closes #87828 The issue seems to stem from #87210 where code headings were changed from a heading containing code to a heading with the `code-header` class. `rustdoc.css` was updated, but `ayu.css` was missed.
2021-08-06Add test for union keyword highlightingGuillaume Gomez-0/+26
2021-08-06Fix highlighting for union keywordGuillaume Gomez-5/+65
2021-08-05Remove LightSpan and use Span directlyGuillaume Gomez-98/+44
2021-08-05Remove warnings/errors from compiler when using typeck_body in rustdoc span ↵Guillaume Gomez-5/+5
map builder
2021-08-05* Rename LightSpan::empty into LightSpan::dummyGuillaume Gomez-23/+19
* Add Classifier::new_light_span to wrap LightSpan::new_in_file constructor
2021-08-05Add missing root_path when generating links using hrefGuillaume Gomez-2/+26
2021-08-05Add documentation and FIXMEGuillaume Gomez-4/+7
2021-08-05Fix invalid generation of HTML in highlightGuillaume Gomez-41/+60
2021-08-05formattingGuillaume Gomez-30/+19
2021-08-05Use rustdoc Span in LinkFromSrc directlyGuillaume Gomez-6/+5
2021-08-05Move extra arguments for highlight URL generation into a new ContextInfo ↵Guillaume Gomez-40/+42
struct for better readability
2021-08-05Wrap the span_map tuple index into a type called "LightSpan"Guillaume Gomez-44/+68
2021-08-05Improve code readabilityGuillaume Gomez-57/+46
2021-08-05* Rename Span::from_rustc_span to Span::newGuillaume Gomez-1/+1
* Rename Span::wrap to Span::wrap_raw * Improve documentation for Span::wrap_raw
2021-08-05* Rename 'move_span' into 'local_span_to_global_span'Guillaume Gomez-14/+78
* Add documentation on new arguments/functions
2021-08-05Underline source code links on hoverGuillaume Gomez-0/+4
2021-08-05Update rustdoc testsGuillaume Gomez-3/+3
2021-08-05Generate links for modules as wellGuillaume Gomez-5/+24
2021-08-05Generate links for methods as wellGuillaume Gomez-19/+39
2021-08-05Add an option for the source code link generationGuillaume Gomez-3/+12
2021-08-05Add links on source types to go to definitionGuillaume Gomez-106/+449
2021-08-04Rollup merge of #87720 - matthiaskrgr:clippy_into, r=jyn514Yuki Okushi-3/+3
don't use .into() to convert types to identical types (clippy::useless_conversion) Example: let _x: String = String::from("hello world").into();
2021-08-03Simplify usage of CSS background-imageGuillaume Gomez-24/+57
2021-08-03Use empty string instead of single spaceMichael Howell-2/+2
2021-08-03Pull the "Expand" / "Collapse" text to the end of the line, instead of startMichael Howell-7/+17
2021-08-03Rustdoc accessibility: use an icon for the [-]/[+] controlsMichael Howell-8/+69
This way, we can show the plus and minus buttons on screens, while voice control will read off actual words "Collapse" and "Expand" instead of reading "open brace minus close brace" and "open brace plus close brace". Part of #87059
2021-08-03don't use .into() to convert types to identical types ↵Matthias Krüger-3/+3
(clippy::useless_conversion) Example: let _x: String = String::from("hello world").into();
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-2/+2
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-29Rollup merge of #87451 - GuillaumeGomez:tuple-struct-field-doc, r=jyn514Yuki Okushi-12/+19
Add support for tuple struct field documentation Fixes #42615. This is #80320 updated to new codebase and with added tests. Part of https://github.com/rust-lang/rust/issues/83255. cc ```@camelid``` (since you were involved on the original PR). r? ```@jyn514```