Commit Graph

419 Commits

Author SHA1 Message Date
Yuki Okushi 145241402d
Rollup merge of #107242 - notriddle:notriddle/title-ordering, r=GuillaumeGomez
rustdoc: make item links consistently use `title="{shortty} {path}"`

The ordering in item tables was flipped in 3030cbea95, making it inconsistent with the ordering in method signatures.

Compare these (before this PR is merged):

c8e6a9e8b6/src/librustdoc/html/render/print_item.rs (L455-L459)

c8e6a9e8b6/src/librustdoc/html/format.rs (L903-L908)
2023-01-27 12:57:55 +09:00
Michael Howell 97f8189614 rustdoc: remove mostly-unused CSS classes import/module-item 2023-01-26 12:55:19 -07:00
Michael Howell 51df99f3c2 rustdoc: use smarter encoding for playground URL
The old way would compress okay with DEFLATE, but this version makes
uncompressed docs smaller, which matters for memory usage and stuff
like `cargo doc`.

Try it out: <https://play.rust-lang.org/?code=fn+main()+{%0Alet+mut+v+=+Vec::new();%0Av.push(1+/+1);%0Aprintln!(%22{}%22,+v[0]);%0A}>

In local testing, this change shrinks sample pages by anywhere between
4.0% and 0.031%

    $ du -b after.dir/std/vec/struct.Vec.html before.dir/std/vec/struct.Vec.html
    759235  after.dir/std/vec/struct.Vec.html
    781842  before.dir/std/vec/struct.Vec.html

100*((759235-781842)/781842)=-2.8

    $ du -b after.dir/std/num/struct.Wrapping.html before.dir/std/num/struct.Wrapping.html
    3194173 after.dir/std/num/struct.Wrapping.html
    3204351 before.dir/std/num/struct.Wrapping.html

100*((3194173-3204351)/3204351)=-0.031

    $ du -b after.dir/std/keyword.match.html before.dir/std/keyword.match.html
    8151    after.dir/std/keyword.match.html
    8495    before.dir/std/keyword.match.html

100*((8151-8495)/8495)=-4.0

Gzipped tarball sizes seem shrunk, but not by much.

    du -s before.tar.gz after.tar.gz
    69600   before.tar.gz
    69480   after.tar.gz

100*((69480-69600)/69600)=-0.17
2023-01-26 10:51:10 -07:00
Michael Howell e65b36110f rustdoc: rearrange HTML in primitive reference links
This patch avoids hard-to-click single character links by making
the generic part of the link:

Before: <a href="#">&</a>T

After: <a href="#">&T</a>
2023-01-23 17:32:22 -07:00
Michael Howell 57ca36861d rustdoc: make item links consistently use `title="{shortty} {path}"`
The ordering in item tables was flipped in 3030cbea95, making it
inconsistent with the ordering in method signatures.

Compare these:

c8e6a9e8b6/src/librustdoc/html/render/print_item.rs (L455-L459)

c8e6a9e8b6/src/librustdoc/html/format.rs (L903-L908)
2023-01-23 14:31:35 -07:00
Guillaume Gomez 13239a9b8e Revert "Add regression test for impl blocks in const expr"
This reverts commit 9cce0bc583.
2023-01-19 20:27:37 +01:00
bors aaa9bb9e7b Auto merge of #106952 - petrochenkov:docglob, r=notriddle,GuillaumeGomez
rustdoc: Fix glob import inlining

Filter away names that are not actually imported by the glob, e.g. because they are shadowed by something else.

Fixes the issue found in https://github.com/rust-lang/rust/pull/94857#issuecomment-1382912356.
2023-01-18 03:54:04 +00:00
Matthias Krüger b90f62988d
Rollup merge of #106869 - notriddle:notriddle/item-decl-pre-rust, r=GuillaumeGomez
rustdoc: remove redundant item kind class from `.item-decl > pre`

This class originated in the very first commit of `rustdoc_ng`, and was used to add a color border around the item decl based on its kind.

4fd061c426/src/rustdoc_ng/html/static/main.css (L102-L106)

The item decl no longer has a border, and there aren't any kind-specific styles in modern rustdoc's rendering of this UI item.

Most of this PR is updating test cases so that they use `item-decl` to find the `<pre>` tag instead of relying on the fact that the class name had `rust {kind}` in it while other `<pre>` tags only had class `rust`.
2023-01-17 05:25:22 +01:00
Vadim Petrochenkov 3b0d306b94 rustdoc: Fix glob import inlining
Filter away names that are not actually imported by the glob, e.g. because they are shadowed by something else
2023-01-17 00:55:28 +04:00
Michael Howell 3a3f70c94e rustdoc: remove redundant item kind class from `.item-decl > pre`
This class originated in the very first commit of `rustdoc_ng`, and was used
to add a color border around the item decl based on its kind.

4fd061c426/src/rustdoc_ng/html/static/main.css (L102-L106)

The item decl no longer has a border, and there aren't any
kind-specific styles in modern rustdoc's rendering of this UI item.

Most of this commit is updating test cases so that they use `item-decl` to
find the `<pre>` tag instead of relying on the fact that the class name
had `rust {kind}` in it while other `<pre>` tags only had class `rust`.
2023-01-14 11:34:03 -07: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
Yuki Okushi ea45b3ef1d
Rollup merge of #106741 - GuillaumeGomez:reexport-doc-hidden, r=notriddle
Fix reexport of `doc(hidden)` item

Part of #59368.

It doesn't fix the `doc(inline)` nor the `doc(hidden)` on macro. I'll do it in a follow-up PR.

r? `@notriddle`
2023-01-13 05:47:23 +09:00
Guillaume Gomez 675640c92a Add test for displayed re-export of `doc(hidden)` 2023-01-12 18:03:50 +01:00
clubby789 740f6aaf95 Fix rendering 'const' for intrinsics 2023-01-12 03:19:08 +00:00
Albert Larsan cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00