about summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2021-10-10Auto merge of #89695 - jsha:more-templates, r=GuillaumeGomezbors-53/+87
Move top part of print_item to Tera templates Part of #84419. This moves the first line of each item page (E.g. `Struct foo::Bar .... 1.0.0 [-][src]` into a Tera template. I also moved template initialization into its own module and added a small macro to reduce duplication and opportunity for errors.
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-76/+60
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-08Move template initialization into its own file.Jacob Hoffman-Andrews-12/+23
2021-10-08Add template for print_itemJacob Hoffman-Andrews-46/+69
Add print_item.html and the code in print_item.rs to use it.
2021-10-07Rollup merge of #89596 - GuillaumeGomez:implicit-doc-cfg, r=jyn514Guillaume Gomez-1/+1
Make cfg imply doc(cfg) This is a reopening of #79341, rebased and modified a bit (we made a lot of refactoring in rustdoc's types so they needed to be reflected in this PR as well): * `hidden_cfg` is now in the `Cache` instead of `DocContext` because `cfg` information isn't stored anymore on `clean::Attributes` type but instead computed on-demand, so we need this information in later parts of rustdoc. * I removed the `bool_to_options` feature (which makes the code a bit simpler to read for `SingleExt` trait implementation. * I updated the version for the feature. There is only one thing I couldn't figure out: [this comment](https://github.com/rust-lang/rust/pull/79341#discussion_r561855624) > I think I'll likely scrap the whole `SingleExt` extension trait as the diagnostics for 0 and >1 items should be different. How/why should they differ? EDIT: this part has been solved, the current code was fine, just needed a little simplification. cc `@Nemo157` r? `@jyn514` Original PR description: This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via `#[doc(cfg(...))]`, so e.g. to hide a `#[cfg]` you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` By adding `#![doc(cfg_hide(foobar))]` to the crate attributes the cfg `#[cfg(foobar)]` (and _only_ that _exact_ cfg) will not be implicitly treated as a `doc(cfg)` to render a message in the documentation.
2021-10-06Rollup merge of #89506 - yaymukund:docblock-headings, r=GuillaumeGomezManish Goregaokar-52/+82
librustdoc: Use correct heading levels. Closes #89309 This fixes the `<h#>` header tags throughout the docs to reflect a semantic hierarchy. - I ran a script to manually check that we don't have any files with multiple `<h1>` tags. - Also checked that we never incorrectly nest e.g. a `<h2>` under an `<h3>`. - I also spot-checked a bunch of pages (`trait.Read`, `enum.Ordering`, `primitive.isize`, `trait.Iterator`).
2021-10-05Allow adding a set of cfg's to hide from being implicitly doc(cfg)'dWim Looman-1/+1
By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg #[cfg(foobar)] (and _only_ that _exact_ cfg) will not be implicitly treated as a doc(cfg) to render a message in the documentation.
2021-10-05Make cfg implicitly imply doc(cfg)Wim Looman-1/+1
This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via #[doc(cfg(...))], so e.g. to hide a #[cfg] you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` (since `all()` is always true, it is never shown in the docs)
2021-10-04heading_level: u32 -> heading_offset: HeadingOffsetMukund Lakshman-38/+48
2021-10-04No need to default offset since we always override it.Mukund Lakshman-33/+29
2021-10-04Change `Markdown(...)` to `Markdown { ... }`Mukund Lakshman-19/+19
2021-10-04Fix heading for methods on trait impls.Mukund Lakshman-1/+1
2021-10-04librustdoc: Use correct heading levels.Mukund Lakshman-19/+43
- Avoid multiple <h1>s on a page. - The <h#> tags should follow a semantic hierarchy. - Cap at h6 (no h7)
2021-10-03Move from grid layout to table based layout because of browser limits that ↵Stefan Schindler-11/+8
overlay row entries after a UA specific amount of rows
2021-10-02Replace all uses of `path.res.def_id()` with `path.def_id()`Noah Lev-2/+2
2021-10-01Auto merge of #89395 - ↵bors-6/+3
In-line:remove_visible_path_from_allowed_deprecated_lint, r=jyn514 Remove visible path calculation from allowed deprecation lint
2021-09-30Remove temporary `GetDefId` impl for `Path`Noah Lev-56/+40
2021-09-30Use `Path` instead of `Type` in `PolyTrait`Noah Lev-18/+18
The change to `impl Clean<Path> for hir::TraitRef<'_>` was necessary to fix a test failure for `src/test/rustdoc/trait-alias-mention.rs`. Here's why: The old code path was through `impl Clean<Type> for hir::TraitRef<'_>`, which called `resolve_type`, which in turn called `register_res`. Now, because `PolyTrait` uses a `Path` instead of a `Type`, the impl of `Clean<Path>` was being run, which did not call `register_res`, causing the trait alias to not be recorded in the `external_paths` cache.
2021-09-30Make `Impl.trait_` a `Path`, not a `Type`Noah Lev-2/+2
It should only ever be a `ResolvedPath`, so this (a) enforces that, and (b) reduces the size of `Impl`. I had to update a test because the order of the rendered auto trait impl bounds changed. I think the order changed because rustdoc sorts auto trait bounds using their `Debug` output.
2021-09-30Remove visible path calculation from allowed deprecation lintAlik Aslanyan-6/+3
2021-09-29Remove Never variant from clean::Type enumGuillaume Gomez-1/+0
2021-09-25Rollup merge of #88895 - camelid:cleanup-pt2, r=jyn514Manish Goregaokar-9/+9
rustdoc: Cleanup `clean` part 2 Split out from #88379. This contains the following commits from that PR: - Remove `Type::ResolvedPath.is_generic` - Rename `is_generic()` to `is_assoc_ty()` r? `@jyn514`
2021-09-21rustdoc: Emphasize "completely unstable"Noah Lev-1/+1
2021-09-21rustdoc: Note that type layout may differ between compilationsNoah Lev-1/+1
2021-09-17Add rustdoc version into the help popupGuillaume Gomez-4/+12
2021-09-16Auto merge of #88219 - jyn514:parallel-io, r=GuillaumeGomezbors-38/+46
rustdoc: reduce number of copies when using parallel IO This is Windows-only for now; I was getting really bad slowdowns from this on linux for some reason. Helps with https://github.com/rust-lang/rust/issues/82741. Follow-up to https://github.com/rust-lang/rust/pull/60971.
2021-09-13Add support for primitives in "jump to definition" featureGuillaume Gomez-7/+11
2021-09-12Rename `is_generic()` to `is_assoc_ty()`Noah Lev-2/+2
The new name is more accurate than the previous one.
2021-09-12Remove `Type::ResolvedPath.is_generic`Noah Lev-9/+9
It can be computed on-demand.
2021-09-12Rollup merge of #88810 - camelid:cleanup-pt1, r=jyn514Manish Goregaokar-22/+24
rustdoc: Cleanup `clean` part 1 Split out from #88379. These commits are completely independent of each other, and each is a fairly small change (the last few are new commits; they are not from #88379): - Remove unnecessary `Cache.*_did` fields - rustdoc: Get symbol for `TyParam` directly - Create a valid `Res` in `external_path()` - Remove unused `hir_id` parameter from `resolve_type` - Fix redundant arguments in `external_path()` - Remove unnecessary `is_trait` argument - rustdoc: Cleanup a pattern match in `external_generic_args()` r? ``@jyn514``
2021-09-11Only take `tcx` when it's all that's neededNoah Lev-7/+12
2021-09-11Rollup merge of #88668 - hvdijk:x32, r=joshtriplettJubilee-1/+1
Change more x64 size checks to not apply to x32. Commit 95e096d6 changed a bunch of size checks already, but more have been added, so this fixes the new ones the same way: the various size checks that are conditional on target_arch = "x86_64" were not intended to apply to x86_64-unknown-linux-gnux32, so add target_pointer_width = "64" to the conditions.
2021-09-10Rollup merge of #88776 - dns2utf8:rustdoc_workaround_1000_elements_grid_bug, ↵Manish Goregaokar-0/+12
r=GuillaumeGomez Workaround blink/chromium grid layout limitation of 1000 rows I made this in case we don't come up with a better solution in time. See https://github.com/rust-lang/rust/issues/88545 for more details. A rendered version of the standard library is hosted here: https://data.estada.ch/rustdoc-nightly_497ee321af_2021-09-09/core/arch/arm/index.html r? `@GuillaumeGomez` `@jsha`
2021-09-10Rollup merge of #88742 - GuillaumeGomez:fix-table-in-docblocks, r=nbdd0121Manish Goregaokar-1/+2
Fix table in docblocks "Overwrite" of #88702. Instead of adding a z-index to the sidebar (which only hides the issue, doesn't fix it), I wrap `<table>` elements inside a `<div>` and limit all chidren of `.docblock` elements' width to prevent having the scrollbar on the whole doc block. ![Screenshot from 2021-09-08 15-11-24](https://user-images.githubusercontent.com/3050060/132515740-71796515-e74f-429f-ba98-2596bdbf781c.png) Thanks `@nbdd0121` for `overflow-x: auto;`. ;) r? `@notriddle`
2021-09-10Rollup merge of #88639 - Emilgardis:fix-issue-88600, r=GuillaumeGomezManish Goregaokar-24/+27
rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields Fixes #88600. ```rust pub struct H; pub struct S; pub enum FooEnum { HiddenTupleItem(#[doc(hidden)] H), MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H), MixedHiddenFirst(#[doc(hidden)] H, S), MixedHiddenLast(S, #[doc(hidden)] H), HiddenStruct { #[doc(hidden)] h: H, s: S, }, } ``` Generates ![image](https://user-images.githubusercontent.com/1502855/132259152-382f9517-c2a0-41d8-acd0-64e5993931fc.png)
2021-09-09Remove unnecessary `Cache.*_did` fieldsNoah Lev-22/+19
They can be obtained by accessing the `TyCtxt` where they are needed.
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-2/+0
2021-09-09Workaround blink/chromium grid layout limitation of 1000 rowsStefan Schindler-0/+12
See https://github.com/rust-lang/rust/issues/88545 for more details
2021-09-08Rollup merge of #86263 - fee1-dead:rustdoc-layout-variants, r=camelidJack Huey-11/+46
Rustdoc: Report Layout of enum variants Followup of #83501, Fixes #86253. cc `@camelid` `@rustbot` label A-rustdoc
2021-09-08Wrap <table> elements into <div> to prevent breaking layout and widthGuillaume Gomez-1/+2
2021-09-06fix ICE on hidden tuple variant fieldsEmil Gardström-24/+27
this also renders them as `_`, which rustdoc previously did not.
2021-09-06Correctly handle niche of enumDeadbeef-4/+8
2021-09-05Auto merge of #88435 - cjgillot:no-walk-crate, r=Aaron1011bors-1/+1
Avoid invoking the hir_crate query to traverse the HIR Walking the HIR tree is done using the `hir_crate` query. However, this is unnecessary, since `hir_owner(CRATE_DEF_ID)` provides the same information. Since depending on `hir_crate` forces dependents to always be executed, this leads to unnecessary work. By splitting HIR and attributes visits, we can avoid an edge to `hir_crate` when trying to visit the HIR tree.
2021-09-05Change more x64 size checks to not apply to x32.Harald van Dijk-1/+1
Commit 95e096d6 changed a bunch of size checks already, but more have been added, so this fixes the new ones the same way: the various size checks that are conditional on target_arch = "x86_64" were not intended to apply to x86_64-unknown-linux-gnux32, so add target_pointer_width = "64" to the conditions.
2021-09-02Rename walk_crate.Camille GILLOT-1/+1
2021-09-02Stop using walk_crate.Camille GILLOT-1/+1
2021-09-01Auto merge of #88490 - GuillaumeGomez:associated-types-implementors-display, ↵bors-38/+81
r=camelid,Manishearth Display associated types of implementors Fixes #86631. Contrary to before, it doesn't display methods. I also had to "resurrect" the `auto-hide-trait-implementations` setting. :3 Only question at this point: should I move the `render_impl` boolean arguments into one struct? We're starting to have quite a lot of them... cc `@cynecx` r? `@camelid`
2021-09-01Remove implementors settingGuillaume Gomez-1/+0
2021-09-01Clean render_impl argumentsGuillaume Gomez-46/+67
2021-09-01Rollup merge of #88410 - camelid:fix-assoc-bold, r=GuillaumeGomezMara Bos-1/+1
Remove bolding on associated constants Associated types don't get bolded, so it looks off to have one kind bolded and one not.