Michael Howell
3a79370367
rustdoc: use better highlighting for *const, *mut, and &mut
...
This generates more consistent HTML for these RefKeyWord combinations.
Before:

After:

2021-10-25 11:13:43 -07:00
Guillaume Gomez
345519baa7
Fix scrollbars appearing on information tooltip on mac when they shouldn't
2021-10-25 11:40:13 +02:00
Matthias Krüger
b837605012
Rollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelid
...
Fix alignment of method headings for scannability
We sometimes use indentation to indicate something is a heading: The section that comes after is indented by 24px relative to the heading. However, the relationship between the "Implementations" section heading, the `impl` headings it contains, and the `pub fn` subheadings within each impl, is awkward. It goes **Implementations**, 15px indent, `impl`, 5px indent, `pub fn`, 4px indent, docblock.
I line up `impl` and `pub fn` with the `Implementations` heading, give `impl` a larger font size to indicate it is higher in the hierarchy, and indent the docblock a full 24px relative to their parent, matching the indents we use elsewhere to distinguish section headings. By letting the `pub fn` stick out to the left of the docblock, I think this makes methods significantly more scannable.
Related to #59829
r? `````@camelid`````
[Old](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations ):
[](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations )
[New](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations ):
[](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations )
2021-10-24 15:48:44 +02:00
Jacob Hoffman-Andrews
542ab2daa6
Outdent method headings so they stand out
...
The makes the heading / documentation distinction clearer.
2021-10-23 11:50:11 -07:00
Matthias Krüger
dcf9242795
Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514
...
Scrape code examples from examples/ directory for Rustdoc
Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123
Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525
Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-23 14:58:39 +02:00
Will Crichton
fd5d614b77
Move def_id logic into render_call_locations
2021-10-22 13:14:46 -07:00
Will Crichton
d1c29c696e
Revert def_id addition from clean::Function, add test for
...
scrape-examples options
2021-10-22 12:46:45 -07:00
bors
4626184caf
Auto merge of #89998 - camelid:box-default, r=jyn514
...
rustdoc: Box some fields of `GenericParamDefKind` to reduce size
This change shrinks `GenericParamDef` from 120 to 56 bytes. `GenericParamDef` is
used a lot, so the extra indirection should hopefully be worth the size savings.
r? `@ghost`
2021-10-21 01:38:55 +00:00
Will Crichton
8f80d86d85
Small scrape-example fixes
2021-10-19 20:08:30 -07:00
Yuki Okushi
570b999c96
Rollup merge of #90036 - jsha:less-rule, r=GuillaumeGomez
...
Remove border-bottom from most docblocks.
Headings in the top-doc docblock still get a border-bottom due to a rule
that covers all h2, h3, and h4. Method docblocks are generally h5, and
so don't get a border-bottom anymore.
This fixes a problem where a sub-sub-heading within a method would have
a line that went all the way across the page, creating a division that
made that sub-sub-heading look much more important than it really is.
Fixes #90033
Demo at https://jacob.hoffman-andrews.com/rust/less-rule/std/string/struct.String.html
r? ``@GuillaumeGomez``
2021-10-20 04:35:17 +09:00
Yuki Okushi
7ceab9ef14
Rollup merge of #90018 - GuillaumeGomez:too-long-item-names, r=jsha
...
Fix rustdoc UI for very long type names
Fixes #89972 .
While working on it, I also discovered that when the item name is too long, it also breaks the flow of the page.
To make things right, I also renamed the `type-decl` CSS class into `item-decl` (because this PR also generates it for more than type declarations).
So here are the before/after screenshots:




r? ``@jsha``
2021-10-20 04:35:15 +09:00
Jacob Hoffman-Andrews
e39934374a
Reduce margin on h5 and h6
2021-10-18 21:04:38 -07:00
Matthias Krüger
0d990a3dbd
Rollup merge of #89867 - Urgau:fix-double-definition, r=GuillaumeGomez
...
Fix macro_rules! duplication when reexported in the same module
This can append if within the same module a `#[macro_export] macro_rules!`
is declared but also a reexport of itself producing two export of the same
macro in the same module. In that case we only want to document it once.
Before:
```
Module {
is_crate: true,
items: [
Id("0:4"), // pub use crate::repro as repro2;
Id("0:3"), // macro_rules! repro
Id("0:3"), // duplicate, same as above
],
}
```
After:
```
Module {
is_crate: true,
items: [
Id("0:4"), // pub use crate::repro as repro2;
Id("0:3"), // macro_rules! repro
],
}
```
Fixes https://github.com/rust-lang/rust/issues/89852
2021-10-19 05:40:51 +02:00
Jacob Hoffman-Andrews
9aec3a0e5a
Remove border-bottom from most docblocks.
...
Headings in the top-doc docblock still get a border-bottom due to a rule
that covers all h2, h3, and h4. Method docblocks are generally h5, and
so don't get a border-bottom anymore.
This fixes a problem where a sub-sub-heading within a method would have
a line that went all the way across the page, creating a division that
made that sub-sub-heading look much more important than it really is.
2021-10-18 20:24:41 -07:00
Noah Lev
90986897c5
rustdoc: Box ty field of GenericParamDefKind::Const
...
This cuts the size of `GenericParamDef` in half, from 104 bytes to 56
bytes. I think the extra indirection should be worth the size savings.
2021-10-18 10:16:01 -07:00
Noah Lev
9b52a633e4
rustdoc: Box default fields of GenericParamDefKind
...
This reduces the size of `GenericParamDef` a bit, but some of the size
savings are hidden because of the `ty` field of the `Const` variant.
I will box that in the next commit.
2021-10-18 10:14:59 -07:00
Guillaume Gomez
809330bda6
Prevent documentation page title to grow too big
2021-10-18 15:30:03 +02:00
Guillaume Gomez
8b7a2dd462
* Remove left margin on items declaration at the top of their documentation page
...
* Rename "type-decl" into "item-decl" to reflect the change of usage
2021-10-18 15:06:38 +02:00
Matthias Krüger
874f19f462
Rollup merge of #89989 - camelid:type-size, r=jyn514
...
rustdoc: Add static size assertion for `clean::Type`
r? `@jyn514`
2021-10-18 08:13:29 +02:00
Noah Lev
9e60288640
Add static size assertion for clean::GenericParamDef
2021-10-17 19:40:23 -07:00
Noah Lev
10b9b3d383
Add static size assertion for clean::Type
2021-10-17 14:30:53 -07:00
Matthias Krüger
e0e2b3cc43
Rollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisa
...
Some "parenthesis" and "parentheses" fixes
"Parenthesis" is the singular (e.g. one `(` or one `)`) and "parentheses" is the plural (multiple `(` or `)`s) and this is not hard to mix up so here are some fixes for that.
Inspired by #89958
2021-10-17 18:18:59 +02:00
r00ster91
3c1d55422a
Some "parenthesis" and "parentheses" fixes
2021-10-17 12:04:01 +02:00
Yuki Okushi
b8173c59c6
Rollup merge of #89943 - matthiaskrgr:clpcompl, r=oli-obk
...
clippy::complexity fixes
2021-10-17 07:52:20 +09:00
Matthias Krüger
c645d3f3b9
clippy::complexity changes
2021-10-16 18:11:16 +02:00
Matthias Krüger
e98669a51a
Rollup merge of #89906 - yuvaldolev:move-format-version-to-rustdoc-json-types, r=CraftSpider
...
Moved format-version constant to rustdoc-json-types
Addresses #88620
Moved format-version constant from rustdoc to rustdoc-json-types.
2021-10-16 08:02:23 +02:00
Urgau
55fad29903
Apply documentation suggestions from code review
...
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2021-10-15 12:21:25 +02:00
Yuval Dolev
43f4ef5c6a
Moved format-version constant to rustdoc-json-types
2021-10-15 12:27:42 +03:00
Loïc BRANSTETT
7d6cfb7754
Oops, inverted condition, fix that
2021-10-14 10:50:46 +02:00
bors
7807a694c2
Auto merge of #89815 - GuillaumeGomez:associated-consts-sidebar, r=notriddle
...
Associated consts sidebar
Fixes #89354 .
A screenshot with `f32`:

2021-10-14 02:24:52 +00:00
Loïc BRANSTETT
15c876db9c
Deduplicate macro_rules! from module_exports when documenting them
...
This can append if within the same module a `#[macro_export] macro_rules!`
is declared but also a reexport of itself producing two export of the same
macro in the same module. In that case we only want to document it once.
2021-10-14 01:51:35 +02:00
Guillaume Gomez
38f6c07b11
Improve code readability for sidebar links
2021-10-13 21:58:55 +02:00
Will Crichton
24a71cbdd7
Fix local crate not being scraped
2021-10-12 18:26:39 -07:00
Guillaume Gomez
d6dbff56e4
List associated constants in the sidebar
2021-10-12 15:06:52 +02:00
Shinwoo Park
d2564ce5a9
rustdoc: update noto sans kr
2021-10-12 04:47:34 +09:00
Stefan Schindler
4bd7e965b2
Cleanup .item-table CSS
2021-10-11 10:53:48 +02:00
Matthias Krüger
bf01a59be5
Rollup merge of #89736 - GuillaumeGomez:rm-unused-css-rule, r=dns2utf8
...
Remove unused CSS rule
As you can see in the firefox devtools:

It needs the display to be `grid` or `inline-grid`, which isn't the case.
r? `@dns2utf8`
2021-10-11 00:34:41 +02:00
Matthias Krüger
9d307f1ed4
Rollup merge of #89722 - jkugelman:cannonical-typo, r=joshtriplett
...
Fix spelling: Cannonical -> Canonical
2021-10-11 00:34:40 +02:00
Matthias Krüger
3fa897df26
Rollup merge of #89632 - GuillaumeGomez:fix-docblock-code, r=jsha
...
Fix docblock code display on mobile
Fixes https://github.com/rust-lang/rust/issues/89618 .
Before:

After:

r? `@jsha`
2021-10-11 00:34:37 +02:00
Guillaume Gomez
5611b43d7f
Remove unused CSS rule
2021-10-10 14:27:36 +02:00
Guillaume Gomez
0bfac7f67f
Fix <code> blocks in doc blocks display on mobile
2021-10-10 13:30:56 +02:00
John Kugelman
169113935f
Fix spelling: Cannonical -> Canonical
2021-10-10 00:44:34 -04:00
bors
c1cb97481a
Auto merge of #89695 - jsha:more-templates, r=GuillaumeGomez
...
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-10 04:41:03 +00:00
bors
a8f2463c68
Auto merge of #88379 - camelid:cleanup-clean, r=jyn514
...
rustdoc: Cleanup various `clean` types
Cleanup various `clean` types.
2021-10-09 19:05:08 +00:00
Jacob Hoffman-Andrews
d0a33fb175
Remove some stray whitespace.
2021-10-09 08:33:19 -07:00
Guillaume Gomez
3e93472aa5
Rollup merge of #89700 - GuillaumeGomez:fix-rustdoc-higher-bound-html-gen, r=notriddle
...
Fix invalid HTML generation for higher bounds
Considering this is a bug, I cherry-picked the commit from #89676 so it's merged more quickly.
r? ``@notriddle``
2021-10-09 17:08:41 +02:00
Guillaume Gomez
321425386a
Fix invalid HTML generation for higher bounds
2021-10-09 14:41:28 +02:00
Jacob Hoffman-Andrews
586a9cea75
Move template initialization into its own file.
2021-10-08 23:28:42 -07:00
Jacob Hoffman-Andrews
7a938005e1
Add template for print_item
...
Add print_item.html and the code in print_item.rs to use it.
2021-10-08 23:02:12 -07:00
Will Crichton
f10dceeae2
Change handling of spans in scrape examples, add test for highlight decorations
2021-10-08 15:32:22 -07:00