1
Fork 0
Commit graph

511 commits

Author SHA1 Message Date
Vadim Petrochenkov
68803926e0 rustdoc: Use DefId(Map,Set) instead of FxHash(Map,Set)
Not all uses are converted, a few cases iterating through maps/sets and requiring nontrivial changes are kept.
2023-01-22 02:12:05 +04:00
Oli Scherer
9f5cd03153 Move compiler input and ouput paths into session 2023-01-16 14:46:44 +00:00
Matthias Krüger
bc0c816410
Rollup merge of #106855 - klensy:rd-s, r=notriddle
rustdoc: few small cleanups
2023-01-14 18:45:28 +01:00
Matthias Krüger
14fbc21466
Rollup merge of #106828 - notriddle:notriddle/notable-trait-docblock, r=GuillaumeGomez
rustdoc: remove `docblock` class from notable trait popover

This commit builds on b72de9be74, which removes the `docblock` class from the All Items page, and 9457380ac9, which removes the `docblock` class from the item decl.

Fixes #92974
2023-01-14 18:45:27 +01:00
Yuki Okushi
caa1d47fba
Rollup merge of #106819 - notriddle:notriddle/rm-h1-fqn, r=GuillaumeGomez
rustdoc: remove unnecessary DOM class `h1.fqn`

It's misleading. The main heading sometimes isn't an fully qualified name at all.

It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-14 12:04:37 +09:00
Michael Howell
5314ed5627 rustdoc: remove docblock class from notable trait popover
This commit builds on b72de9be74, which removes
the `docblock` class from the All Items page, and
9457380ac9, which removes the `docblock` class
from the item decl.

Fixes #92974
2023-01-13 15:42:29 -07:00
Michael Howell
1d328de3ec rustdoc: rename CSS rustdoc-toggle -> toggle and toggle -> settings-toggle
This swaps things around so that the class that gets used more often has
the shorter name.
2023-01-13 12:38:03 -07:00
Michael Howell
39b90a5f6e rustdoc: remove unnecessary DOM class h1.fqn
It's misleading. The main heading sometimes isn't an fully qualified name at all.

It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-13 10:09:25 -07:00
klensy
4e1258c6b6 IndexItem.name String -> Symbol 2023-01-13 15:39:16 +03:00
klensy
60cc7783da evade clones 2023-01-13 15:07:14 +03:00
Michael Howell
2b661c33de rustdoc: simplify CSS and DOM for more-scraped-examples
This gets rid of the more-scraped-examples-inner wrapper, instead nesting the
children directly and using absolute positioning for the toggle line.
2022-12-21 18:03:31 -07:00
Guillaume Gomez
14b508fbec Don't add "Read more" link if there is no extra content 2022-12-16 14:52:35 +01:00
Michael Howell
7e64cebf97 rustdoc: stop treating everything in a trait item as a method
This was added in 0b9b4b7068 to fix the
spacing on trait pages, but stopped being needed because
791f04e5a4 stopped styling method-toggle.
By only putting the method-toggle class on actual methods, the JS setting
does the right thing.
2022-12-12 12:49:29 -07:00
Will Crichton
ae270f1b99 Update scrape-examples help, fix documentation typos 2022-12-07 09:08:43 -08:00
Will Crichton
6ccd14a782 Improve several aspects of the Rustdoc scrape-examples UI.
* Examples take up less screen height.
* Snippets from binary crates are prioritized.
* toggle-all-docs does not expand "More examples" sections.
2022-12-07 09:08:43 -08:00
Michael Howell
19e0200296 rustdoc: remove fnname CSS class that's styled exactly like fn
It's not obvious why this was ever a separate class name, since even
in c4219a4783 when it was first added,
it was styled identically to regular `fn` links.
2022-11-28 10:51:46 -07:00
Guillaume Gomez
aa73e29799 Improve accessibility:
* Set aria-label attribute on search input
 * Put anchor text directly into the DOM and not in the CSS
2022-11-23 15:08:00 +01:00
Vadim Petrochenkov
7a5376d23c Unreserve braced enum variants in value namespace 2022-11-21 22:40:06 +03:00
Michael Howell
a979b4a508 rustdoc: use real buttons for scrape examples controls 2022-11-19 12:27:40 -07:00
Yuki Okushi
528b4af796
Rollup merge of #104177 - notriddle:notriddle/js-notable-trait-v2, r=GuillaumeGomez
rustdoc: use consistent "popover" styling for notable traits

Follow-up to #104129
Fixes https://github.com/rust-lang/rust/issues/104313.

Preview: https://notriddle.com/notriddle-rustdoc-demos/js-notable-trait-v2/std/iter/trait.Iterator.html#method.step_by

## Before

![image](https://user-images.githubusercontent.com/1593513/200710372-d2d992ce-0bdc-4437-9a2e-379a29df09cf.png)

![image](https://user-images.githubusercontent.com/1593513/200711266-e372b176-daa9-45f3-a022-738ef0a77d3c.png)

## After

![image](https://user-images.githubusercontent.com/1593513/200710601-09b3b717-116f-43c6-b14f-34a8b02b33c0.png)

![image](https://user-images.githubusercontent.com/1593513/200711288-3978cdc1-a6c2-47f6-9216-e22e3c1f5bdf.png)
2022-11-13 16:41:44 +09:00
Yuki Okushi
96753eb0e0
Rollup merge of #103650 - notriddle:notriddle/line-anchors, r=GuillaumeGomez
rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a`

Example: https://notriddle.com/notriddle-rustdoc-demos/line-anchors/test_dingus/fn.test.html

This allows people to treat them like real links, such as right-click to copy URL, and makes the line numbers in a scraped example work at all, when before this commit was added, they had the clickable pointer cursor but did not actually do anything when clicked.
2022-11-13 16:41:44 +09:00
Michael Howell
cb3a04b6ef rustdoc: avoid excessive HTML generated in example sources 2022-11-12 09:23:09 -07:00
Michael Howell
89ba71649f rustdoc: use consistent "popover" styling for notable traits 2022-11-11 17:27:03 -07:00
Michael Howell
05824cd7b7 rustdoc: fix HTML validation failure by escaping data-ty 2022-11-11 10:01:54 -07:00
Michael Howell
53e8b490d8 rustdoc: sort output to make it deterministic 2022-11-09 13:55:52 -07:00
Michael Howell
303653ef65 rustdoc: use javascript to layout notable traits popups
Fixes #102576
2022-11-07 22:45:24 -07:00
Michael Howell
8e0cac18cd rustdoc: refactor notable_traits_decl to just act on the type directly 2022-11-07 11:13:01 -07:00
Guillaume Gomez
df326946ed Remove rustdoc clean::Visibility type 2022-11-03 18:15:24 +01:00
Michael Howell
07bb2f701e rustdoc: change .src-line-numbers > span to .src-line-numbers > a
This allows people to treat them like real links, such as right-click to
copy URL, and makes the line numbers in a scraped example work at all,
when before this commit was added, they had the clickable pointer cursor
but did not actually do anything when clicked.
2022-10-31 13:59:52 -07:00
Guillaume Gomez
5515e2c2a1 Make rustdoc Item::visibility computed on-demand 2022-10-30 16:50:53 +01:00
Guillaume Gomez
4fac361ea3 Fix z-indexes of code example feature and cleanup its CSS 2022-10-29 12:23:10 +02:00
Yuki Okushi
ec7ffdfbaf
Rollup merge of #103432 - jsha:box-is-not-notable, r=GuillaumeGomez
rustdoc: don't mark Box<T> as Iterator, Read, etc

Because Box<T> has pass-through implementations, rustdoc was giving it the "Notable Traits" treatment for Iterator, Read, Write, and Future, even when the type of T was unspecified.

Pin had the same problem, but just for Future.

Fixes #100320
2022-10-27 08:30:54 +09:00
Jacob Hoffman-Andrews
63d1a721f1 rustdoc: don't mark Box<T> as Iterator, Read, etc
Because Box<T> has pass-through implementations, rustdoc was giving it the
"Notable Traits" treatment for Iterator, Read, Write, and Future, even when the
type of T was unspecified.

Pin had the same problem, but just for Future.
2022-10-23 22:14:10 -07:00
Michael Howell
a01b88575e rustdoc: remove class name location from sidebar sibling nav
This change tweaks the CSS to apply most of its styles to `.sidebar h2`,
cleaning up a few redundant rules from `.mobile-topbar .location` and
restoring useful navigation aids in mobile mode.
2022-10-18 12:01:53 -07:00
Michael Howell
e9b2922804 rustdoc: remove unused HTML class sidebar-title
Since 6a5f8b1aef, this class is no
longer styled.
2022-10-15 11:24:49 -07:00
Michael Howell
44f466cb08
Remove outdated comment 2022-10-10 17:53:27 -07:00
Michael Howell
b63b02f872 rustdoc: remove unneeded <div> wrapper from sidebar DOM
When this was added, the sidebar had a bit more complex style. It can be
removed, now.
2022-10-10 11:40:15 -07:00
Michael Howell
3cb03cb342 rustdoc: remove unused CSS class in-band
Since a7c25b2957 removed `in-band` from code
headers, the only remaining uses of the `in-band` class are:

02cd79afb8/src/librustdoc/html/render/write_shared.rs (L520-L521)

02cd79afb8/src/librustdoc/html/templates/print_item.html (L2-L3)

02cd79afb8/src/librustdoc/html/render/context.rs (L637-L638)

02cd79afb8/src/librustdoc/html/render/mod.rs (L368-L369)

02cd79afb8/src/librustdoc/html/render/mod.rs (L401-L402)

02cd79afb8/src/librustdoc/html/static/js/main.js (L525)

Since all of these uses are nested below `h1.fqn`, we can get rid of it,
and the support code that was used for when `in-band` was part of item
rendering.
2022-10-05 16:56:07 -07:00
Michael Howell
a63a03dc54 rustdoc: remove clean::TraitWithExtraInfo
Instead, it gathers the extra info later, when it's actually requested.
2022-09-27 12:27:04 -07:00
Michael Howell
a7c25b2957 rustdoc: clean up .out-of-band/.in-band CSS
* Remove the `float: right` fallback from the main header, which hasn't
  been needed since IE11 support was dropped.

* Remove `in-band` from low-level headers, which hasn't been needed since
  `.rightside` switched to `float: right` in
  593d6d1cb1

* Remove unreachable `.in-band > code, .in-band > .code-header` CSS, since
  the `in-band` class was attached to the `code-header` itself, not nested
  directly below it.

* Use `rem` instead of `em` for code header margins.

* This results in a slight change in spacing around impls and item-info,
  but since it makes it more consistent with the way methods are presented,
  it's probably fine.
2022-09-25 13:48:17 -07:00
Matthias Krüger
6d6d89b08b
Rollup merge of #102158 - notriddle:notriddle/stab-p, r=GuillaumeGomez
rustdoc: clean up CSS/DOM for deprecation warnings

Preview: https://notriddle.com/notriddle-rustdoc-test/stab-p/std/macro.try.html
2022-09-23 15:40:23 +02:00
Michael Howell
dedf6fcde4 rustdoc: clean up CSS/DOM for deprecation warnings 2022-09-22 14:54:38 -07:00
Guillaume Gomez
d3f97a331c Improve some AllTypes fields name 2022-09-22 13:08:59 +02:00
Guillaume Gomez
27a420f251 Unify generation of section on "All items" page with all other pages 2022-09-20 23:23:03 +02:00
Guillaume Gomez
5343dc7c99 Generate sidebar elements for the "All items" page 2022-09-20 17:10:21 +02:00
Michael Howell
b72de9be74 rustdoc: clean up CSS for All Items and All Crates lists
This reduces the amount of CSS, and makes these two pages more consistent
(which, necessarily, means changing them a bit).
2022-09-16 13:59:45 -07:00
Matthias Krüger
6f4726541e more clippy::perf fixes 2022-09-03 22:57:22 +02:00
Matthias Krüger
21c8447d78
Rollup merge of #101245 - GuillaumeGomez:remove-unneeded-where-whitespace, r=notriddle
Remove unneeded where whitespace

It fixes these two bugs:

![Screenshot from 2022-08-31 18-14-40](https://user-images.githubusercontent.com/3050060/187727950-94657419-abfa-454c-9d27-004280fbcb45.png)
![Screenshot from 2022-08-31 18-14-49](https://user-images.githubusercontent.com/3050060/187727956-21d1b39d-62d7-4e7b-8f6f-631ceda67a19.png)

It's a relic from a very old time (this commit: bfd01b7f40).

You can test the result [here](https://rustdoc.crud.net/imperio/remove-unneeded-where-whitespace/lib2/struct.WhereWhitespace.html).

cc `````````@jsha`````````
r? `````````@notriddle`````````
2022-09-01 21:37:11 +02:00
Guillaume Gomez
803e35abf7 Remove unneeded extra whitespace before where clause 2022-08-31 18:13:39 +02:00
Ralf Jung
8ed9ac658a
Rollup merge of #101204 - aDotInTheVoid:async-resugar-in-clean, r=GuillaumeGomez
rustdoc: Resugar async fn return type in `clean`, not `html`

This way it also happens for json output.

Fixes #101199

r? ``@GuillaumeGomez``
2022-08-31 14:29:54 +02:00