about summary refs log tree commit diff
path: root/src/librustdoc/html/render/print_item.rs
AgeCommit message (Collapse)AuthorLines
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-1/+2
2024-12-19Rename TyAssocConstItem -> RequiredAssocConstItemDavid Tolnay-1/+2
2024-12-14Add some convenience helper methods on `hir::Safety`Oli Scherer-4/+2
2024-12-01Move `SharedContext` out of `Rc`Guillaume Gomez-61/+56
2024-12-01Stop cloning `Context` so muchGuillaume Gomez-1/+1
2024-11-28Fix new clippy lintsGuillaume Gomez-11/+11
2024-11-13rustdoc: Treat decl macros like other itemsLeón Orell Valerian Liehr-2/+7
2024-11-01rustdoc: Directly use rustc_abi instead of reexportsJubilee Young-1/+1
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-16rustdoc: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-6/+8
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-2/+2
2024-09-30rustdoc: rewrite stability inheritance as a passLukas Markeffsky-19/+12
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-6/+6
2024-09-07rustdoc: use a single box to store Attributes and ItemKindMichael Howell-19/+19
2024-09-05Add missing sidebar associated itemsGuillaume Gomez-16/+16
2024-08-30Remove `#[macro_use] extern crate tracing` from rustdoc.Nicholas Nethercote-0/+1
2024-08-01rustdoc: Remove OpaqueTyAlona Enraght-Moony-31/+0
2024-07-29rustdoc: properly handle path wrappingMichael Howell-1/+1
2024-07-29rustdoc: word wrap CamelCase in the item list tableMichael Howell-3/+3
This is an alternative to ee6459d6521cf6a4c2e08b6e13ce3c6ce5d55ed0. That is, it fixes the issue that affects the very long type names in https://docs.rs/async-stripe/0.31.0/stripe/index.html#structs. This is, necessarily, a pile of nasty heuristics. We need to balance a few issues: - Sometimes, there's no real word break. For example, `BTreeMap` should be `BTree<wbr>Map`, not `B<wbr>Tree<wbr>Map`. - Sometimes, there's a legit word break, but the name is tiny and the HTML overhead isn't worth it. For example, if we're typesetting `TyCtx`, writing `Ty<wbr>Ctx` would have an HTML overhead of 50%. Line breaking inside it makes no sense.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-7/+7
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-27rustdoc: use strategic ThinVec/Box to shrink `clean::ItemKind`Michael Howell-3/+3
2024-07-24rustdoc: clean up and fix ord violations in item sortingMichael Howell-69/+118
Based on e3fdafc263a4a705a3bec1a6865a4d011b2ec7c5 with a few minor changes: - The name sorting function is changed to follow the [version sort] from the style guide - the `cmp` function is redesigned to more obviously make a partial order, by always return `cmp()` of the same variable as the `!=` above [version sort]: https://doc.rust-lang.org/nightly/style-guide/index.html#sorting Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-07-23Replace askama with rinjaGuillaume Gomez-3/+3
2024-07-19Improve display of trait bounds when there are more than twoGuillaume Gomez-7/+14
2024-06-20Implement `unsafe_extern_blocks` feature in rustdocGuillaume Gomez-5/+18
2024-06-05Remove `Type` from rustdoc `Const`Boxy-5/+12
2024-05-26rustdoc: Show "const" for const-unstable if also overall unstableNoah Lev-1/+12
If a const function is unstable overall (and thus, in all circumstances I know of, also const-unstable), we should show the option to use it as const. You need to enable a feature to use the function at all anyway. If the function is stabilized without also being const-stabilized, then we do not show the const keyword and instead show "const: unstable" in the version info.
2024-05-17Rename Unsafe to SafetySantiago Pastorino-7/+7
2024-04-19Auto merge of #118441 - GuillaumeGomez:display-stability-version, r=rustdocbors-5/+1
Always display stability version even if it's the same as the containing item Fixes https://github.com/rust-lang/rust/issues/118439. Currently, if the containing item's version is the same as the item's version (like a method), we don't display it on the item. This was something done on purpose as you can see [here](https://github.com/rust-lang/rust/blob/e9b7bf011478aa8c19ac49afc99853a66ba04319/src/librustdoc/html/render/mod.rs#L949-L955). It was implemented in https://github.com/rust-lang/rust/pull/30686. I think we should change this because on pages with a lot of items, if someone arrives (through the search or a link) to an item far below the page, they won't know the stability version unless they scroll to the top, which isn't great. You can see the result [here](https://rustdoc.crud.net/imperio/display-stability-version/std/pin/struct.Pin.html#method.new). r? `@notriddle`
2024-04-09rustdoc: load icons from css instead of inlineMichael Howell-12/+2
This cuts the HTML overhead for a page by about 1KiB, significantly reducing the overall size of the docs bundle.
2024-04-09rustdoc: clean up type alias codeMichael Howell-16/+12
2024-03-27rustdoc: Swap fields and variant documentationschloekek-2/+2
Previously, the documentation for a variant appeared after the documentation for each of its fields. This was inconsistent with structs and unions, and made little sense on its own; fields are subordinate to variants and should therefore appear later in the documentation.
2024-03-14fix polarityManish Goregaokar-2/+2
2024-03-14Make compactManish Goregaokar-10/+10
2024-03-14Refactor visibility_print_with_space to directly take an itemManish Goregaokar-33/+15
2024-03-14print ghostsManish Goregaokar-0/+6
2024-03-01Correctly generate item info of trait itemsGuillaume Gomez-3/+6
2024-01-19Rollup merge of #117662 - GuillaumeGomez:links-in-headings, r=notriddleMatthias Krüger-61/+51
[rustdoc] Allows links in headings Reopening of https://github.com/rust-lang/rust/pull/94360. # Explanations Rustdoc currently doesn't follow the markdown spec on headings: we don't allow links in them. So instead of having headings linking to themselves, this PR generates an anchor on the left side like this: ![image](https://github.com/rust-lang/rust/assets/3050060/a118a7e9-5ef8-4d07-914f-46defc3245c3) <details> <summary>previous version</summary> ![image](https://github.com/rust-lang/rust/assets/3050060/c34fa844-9cd4-47dc-bb51-b37f5f66afee) </details> Having the anchor always displayed allows for mobile devices users to be able to have a link to the anchor. The different color used for the anchor itself is the same as links so people notice when looking at it that they can click on it. You can test it [here](https://rustdoc.crud.net/imperio/links-in-headings/std/index.html). cc `@camelid` r? `@notriddle`
2024-01-08Rustdoc and Clippy stop misusing Key for Ty -> (adt) DefIdMichael Goulet-2/+1
2023-12-15Rollup merge of #113091 - GuillaumeGomez:prevent-cfg-merge-reexport, r=rustdocGuillaume Gomez-11/+2
Don't merge cfg and doc(cfg) attributes for re-exports Fixes #112881. ## Explanations When re-exporting things with different `cfg`s there are two things that can happen: * The re-export uses a subset of `cfg`s, this subset is sufficient so that the item will appear exactly with the subset * The re-export uses a non-subset of `cfg`s (e.g. like the example I posted just above where the re-export is ungated), if the non-subset `cfg`s are active (e.g. compiling that example on windows) then this will be a compile error as the item doesn't exist to re-export, if the subset `cfg`s are active it behaves like 1. ### Glob re-exports? **This only applies to non-glob inlined re-exports.** For glob re-exports the item may or may not exist to be re-exported (potentially the `cfg`s on the path up until the glob can be removed, and only `cfg`s on the globbed item itself matter), for non-inlined re-exports see https://github.com/rust-lang/rust/issues/85043. cc `@Nemo157` r? `@notriddle`
2023-12-05Generate section headings all from one placeGuillaume Gomez-61/+51
2023-12-05Make all headings display the same by creating an anchor right beside themGuillaume Gomez-1/+1
2023-12-04Don't generate the "Fields" heading if there is no field displayedGuillaume Gomez-1/+8
2023-12-01Add highlighting for comments in items declarationGuillaume Gomez-8/+14
2023-11-29rustdoc: remove small from `small-section-header`Michael Howell-7/+7
There's no such thing as a big section header, so I don't know why the name was used.
2023-11-29Always display stability version even if it's the same as the containing itemGuillaume Gomez-5/+1
2023-11-29rustdoc: Move `AssocItemRender` and `RenderMode` to `html::render`.Alona Enraght-Moony-2/+3
They're only used for HTML, so it makes more sense for them to live their.
2023-11-24Replace `option.map(cond) == Some(true)` with `option.is_some_and(cond)`David Tolnay-2/+4
2023-11-23Sort unstable items last in rustdoc, instead of firstDavid Tolnay-2/+2
2023-11-23Don't print "private fields" on empty tuple structsKyuuhachi-5/+9
Test for presence rather than absence Remove redundant tests Issues in those parts will likely be caught by other parts of the test suite.
2023-11-22Don't merge cfg and doc(cfg) attributes for re-exportsGuillaume Gomez-11/+2