| Age | Commit message (Collapse) | Author | Lines |
|
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.
|
|
rustdoc: Cleanup various `clean` types
Cleanup various `clean` types.
|
|
|
|
Add print_item.html and the code in print_item.rs to use it.
|
|
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.
|
|
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`).
|
|
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.
|
|
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)
|
|
|
|
|
|
|
|
|
|
- Avoid multiple <h1>s on a page.
- The <h#> tags should follow a semantic hierarchy.
- Cap at h6 (no h7)
|
|
overlay row entries after a UA specific amount of rows
|
|
|
|
In-line:remove_visible_path_from_allowed_deprecated_lint, r=jyn514
Remove visible path calculation from allowed deprecation lint
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
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`
|
|
|
|
|
|
|
|
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.
|
|
|
|
The new name is more accurate than the previous one.
|
|
It can be computed on-demand.
|
|
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``
|
|
|
|
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.
|
|
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`
|
|
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.

Thanks `@nbdd0121` for `overflow-x: auto;`. ;)
r? `@notriddle`
|
|
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

|
|
They can be obtained by accessing the `TyCtxt` where they are needed.
|
|
|
|
See https://github.com/rust-lang/rust/issues/88545 for more details
|
|
Rustdoc: Report Layout of enum variants
Followup of #83501, Fixes #86253.
cc `@camelid`
`@rustbot` label A-rustdoc
|
|
|
|
this also renders them as `_`, which rustdoc previously did not.
|
|
|
|
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.
|
|
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.
|
|
|
|
|
|
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`
|
|
|
|
|
|
Remove bolding on associated constants
Associated types don't get bolded, so it looks off to have one kind
bolded and one not.
|