357 Commits

Author SHA1 Message Date
Michael Howell
c9293bfdae rustdoc-search: add test case for throbber 2025-10-07 12:59:58 -07:00
bors
dd091003ac Auto merge of #145898 - lolbinarycat:rustdoc-search-trait-parent, r=GuillaumeGomez,notriddle
If a trait item appears in rustdoc search, hide the corrosponding impl items

fixes rust-lang/rust#138251

cc `@notriddle`
2025-10-03 08:43:43 +00:00
binarycat
2dd00d3391 fix rustdoc tests broke by trait item filtering 2025-10-02 15:28:00 -05:00
Guillaume Gomez
6cccea8731 Remove doc_auto_cfg feature as well 2025-09-27 11:30:57 +02:00
Matthias Krüger
1285b164e1 Rollup merge of #147047 - notriddle:toolbar-index, r=GuillaumeGomez
rustdoc: put the toolbar on the all item index
2025-09-26 06:36:33 +02:00
Michael Howell
51ae86dec9 rustdoc-search: add test case for all/index.html search 2025-09-25 15:45:11 -07:00
León Orell Valerian Liehr
85c193a4ed rustdoc: hide #[repr(...)] if it isn't part of the public ABI 2025-09-25 11:49:27 +02:00
Guillaume Gomez
b6f8824315 Ensure that --html-after-content option is used to check scrape_examples_ice rustdoc GUI test 2025-09-05 15:13:08 +02:00
Janis
f67e29e5a8 squash fix render_call_locations panic when default span points at file outside of local_sources
add test against crashing with --html-after-content file

correctly add --html-after-content to env not args

formatting fix for rustdoc-call-locations-after-content/rmake.rs

Use local crate source file as default span in `render_call_locations`

- avoids unwrapping the first file added to the source map as a local file in
`href_from_span`

move test to tests/rustdoc-gui, rename to scrape_examples_ice

test link is correct

use rustdocflags, rename path in example, track lock file

factor out duplicate function calls

use compile-flags to make sure the after.html file is actually included in the rustdoc call

fix goml go-to path

increment assert-count in sidebar-source-code.goml

adjust crate-search width in search-result-display.goml

renamed Bar in scrape_examples_ice test

make crate name shorter ..
2025-09-02 01:38:23 +02:00
Guillaume Gomez
75cbd05d19 Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
bors
809200ec95 Auto merge of #137229 - GuillaumeGomez:expand-macro, r=lolbinarycat
Add support for macro expansion in rustdoc source code pages

This is what it looks like:

![Screenshot From 2025-02-18 18-08-51](https://github.com/user-attachments/assets/ce2b3806-6218-47df-94bf-e9e9ed40cd41)

![image](https://github.com/user-attachments/assets/891042db-8632-4dba-9343-e28570c058fe)

You can test it [here](https://rustdoc.crud.net/imperio/macro-expansion/src/lib/lib.rs.html). In this case, I also enabled the `--generate-link-to-definition` to show that both options work well together.

Note: <del>There is a bug currently in firefox where the line numbers are not displayed correctly if they're inside the "macro expansion" span: https://bugzilla.mozilla.org/show_bug.cgi?id=1949948<del> Found a workaround around this bug.

r? `@notriddle`
2025-08-24 19:46:17 +00:00
Guillaume Gomez
f5fddc776c Improve code and add test with macro coming from another file from the same crate 2025-08-23 10:57:14 +02:00
Guillaume Gomez
b968ef8d19 Make macro expansion feature buttons accessible 2025-08-23 00:57:29 +02:00
Guillaume Gomez
f8b8cc4cce Do macro expansion at AST level rather than HIR 2025-08-23 00:57:29 +02:00
Guillaume Gomez
e6f9e2e623 Add GUI test for --generate-macro-expansion option 2025-08-23 00:57:28 +02:00
Michael Howell
53b775d9c6 rustdoc-search: GUI tests check for // in URL
When this fails, you get output that looks like:

    /home/user/rust/tests/rustdoc-gui/search-result-impl-disambiguation.goml search-result-impl-disambiguation... FAILED
    [ERROR] `tests/rustdoc-gui/utils.goml` around line 49
        from `tests/rustdoc-gui/search-result-impl-disambiguation.goml` line 25: JS errors occurred: Event: Event

Making the error message more informative requires patching browser-ui-test.
2025-08-21 09:24:54 -07:00
Michael Howell
8511e40e72 rustdoc-search: search backend with partitioned suffix tree 2025-08-15 10:26:03 -07:00
Guillaume Gomez
22607491bb Add GUI regression test for tooltips i icons 2025-08-04 19:17:08 +02:00
Guillaume Gomez
b4f404b581 Fix wrong font being used for tooltips i icons 2025-08-04 19:17:08 +02:00
Guillaume Gomez
7c3bddaa74 Update rustdoc GUI tests 2025-07-01 15:49:45 +02:00
binarycat
00c104225f rustdoc: make srcIndex no longer a global variable
this is one-time initialization data, it can just
be a function parameter.

we also move the json parsing into createSrcSidebar
to save a few bytes.
2025-06-16 20:22:24 -05:00
Jacob Pratt
045ac21c6f Rollup merge of #139831 - lolbinarycat:rustdoc-mobile-sidebar, r=GuillaumeGomez
rustdoc: on mobile, make the sidebar full width and linewrap

this is because the mobile sidebar cannot be resized, unlike on desktop.
2025-05-25 04:00:55 +02:00
binarycat
bcca611b35 rustdoc-gui test: apply suggestions from code review 2025-05-23 17:43:19 -05:00
binarycat
1eba1b56e3 rustdoc: rip out all the gui tests for <100% width mobile sidebar
stuff like "clicking the settings menu closes the mobile sidebar"
is now impossible for users to observe, since the mobile sidebar
will always cover the settings menu due to being full-width,
which is good because that behavior is also now impossible for
our testing framework to observe.
2025-05-22 16:44:29 -05:00
Matthias Krüger
981bbf4197 Rollup merge of #140868 - SpecificProtagonist:rustdoc-trait-impl-code-link, r=notriddle
rustdoc: Fix links with inline code in trait impl docs

Fixes #140857
2025-05-22 07:19:01 +02:00
SpecificProtagonist
4516a5b96b better checks 2025-05-11 08:02:19 +02:00
SpecificProtagonist
b8d55544c5 remove superfluous import 2025-05-11 07:58:18 +02:00
SpecificProtagonist
bd23ee2382 gui test different link 2025-05-10 19:48:13 +02:00
SpecificProtagonist
31ae60d30d gui test 2025-05-10 19:36:28 +02:00
Michael Howell
3fa98a1507 rustdoc: add a handle that makes sidebar resizing more obvious
This change is based on some discussion on [lolbinarycat's idea],
but with a more "traditional" design. Specifically, this is the
closest thing I could find to a consensus across many systems I
looked at for inspiration:

- In Jira, resizable sidebars have a stack of four dots.
- In The GIMP, resizable sidebars have a stack of three dots.
- In [old Windows], "panes" are defined to have the same border
  style as a window, which has a raised appearance.
- In [NeXT], a drag point usually had an innie, whether the line in a
  slider or the circle in a scroller; I can also hide and show the
  favorites bar in Workspace by dragging on a circular "grip spot"
- In [old Mac], drag handles for things usually had a "grip track"
  of parallel lines.
- [OSX] kept that, but the "Source List" part of the Finder still had
  the circle grip for a time the same way Workspace did

[lolbinarycat's idea]: https://github.com/rust-lang/rust/pull/139420
[old Windows]: https://archive.org/details/windowsinterface00micr/page/n9/mode/2up
[old Mac]: https://archive.org/details/apple-hig/1996_Human_Interface_Guidelines_for_Mac_OS_8_%28WWDC_Release%29/page/16/mode/2up
[NeXT]: https://archive.org/details/apple-hig/1993%20NeXTSTEP%20User%20Interface%20Guidelines%20-%20Release%203/page/145/mode/2up
[OSX]: https://dn721903.ca.archive.org/0/items/apple-hig/MacOSX_HIG_2005_09_08.pdf#page=267
2025-05-09 12:38:00 -07:00
Guillaume Gomez
a92ba60d0f Rollup merge of #140135 - GuillaumeGomez:sidebars-image, r=rustdoc
Unify sidebar buttons to use the same image

Part of https://github.com/rust-lang/rust/issues/139832.

The source sidebar looks like this with the new image:

![image](https://github.com/user-attachments/assets/df4fee52-fb71-4794-91b7-3afc6d2aab70)

You can test it [here](https://rustdoc.crud.net/imperio/sidebar-images/src/foo/foo.rs.html).

r? `@notriddle`
2025-05-06 14:50:45 +02:00
Guillaume Gomez
a29072a67a Add/update GUI test for impl indent fix 2025-04-24 12:33:29 +02:00
Guillaume Gomez
f7d8558003 Add rustdoc-gui test to ensure sidebars share the same image 2025-04-23 21:34:50 +02:00
Guillaume Gomez
30f56df6f9 Add regression test for #139282 2025-04-07 17:28:46 +02:00
León Orell Valerian Liehr
8462d56fc1 Rollup merge of #137539 - GuillaumeGomez:copy-content-tests, r=notriddle
Add rustdoc-gui regression test for #137082

Fixes https://github.com/rust-lang/rust/issues/137082.

Added new commands in `browser-ui-test` allowing us to add a regression test for #137082 and also another to copy code examples content.

r? `@notriddle`
2025-02-25 13:07:34 +01:00
Guillaume Gomez
592028a2fc Add rustdoc-gui regression test for #137082 2025-02-24 14:27:33 +01:00
Jacob Pratt
8133652562 Rollup merge of #136991 - GuillaumeGomez:code-wrapping, r=notriddle
[rustdoc] Add new setting to wrap source code lines when too long

Fixes https://github.com/rust-lang/rust/issues/127334.

Wrapped lines look like this:

![image](https://github.com/user-attachments/assets/92006a27-ed1e-4beb-91f2-f453b72c5e1a)

It works in both source code pages and doc pages.

You can test it [here](https://rustdoc.crud.net/imperio/code-wrapping/bar/index.html).

r? ``@notriddle``
2025-02-24 02:11:32 -05:00
Guillaume Gomez
a1471f3aa6 Rename feature into Word wrap source code 2025-02-22 15:44:14 +01:00
yukang
a467ecacd4 Add custom sort for link in rustdoc 2025-02-19 08:35:51 +08:00
Guillaume Gomez
38b5bfce24 Add GUI test for code wrapping 2025-02-14 11:41:28 +01:00
Guillaume Gomez
10d666f3d6 Update rustdoc-gui test 2025-02-14 11:41:28 +01:00
Michael Howell
2c4922cf29 rustdoc: use better, consistent SVG icons for scraped examples
This continues two ongoing projects:

- Replacing ascii art with real icons that don't look like
  syntax, are understandable to people who're familiar with
  desktop computers and smart devices, and aren't ugly.
- Using labels and tooltips to clarify these icons, when the
  limits of popular iconography hit us. In this case, I've added
  tooltips, because, unfortunately, there's not room for
  always-visible labels.
2025-02-12 16:07:11 -07:00
Guillaume Gomez
673fd23dff Update rustdoc tests 2025-02-11 14:29:58 +01:00
Guillaume Gomez
65fedebfc4 Add GUI test for new "sans serif fonts" setting 2025-01-29 11:01:14 +01:00
Guillaume Gomez
caacb04830 Add GUI regression test for indent of trait items on mobile 2025-01-24 15:36:52 +01:00
Guillaume Gomez
b3865d1832 Remove more CSS classes 2025-01-18 20:29:55 +01:00
Guillaume Gomez
3c62ccdff5 Update rustdoc tests 2025-01-17 22:36:49 +01:00
binarycat
9397d133f6 Treat other items as functions for the purpose of type-based search
constants and statics are nullary functions, and struct fields are unary functions.

functions (along with methods and trait methods) are prioritized over other
items, like fields and constants.
2025-01-16 11:52:00 -06:00
Guillaume Gomez
0128c910f4 Add GUI test for #135499 2025-01-15 16:31:20 +01:00
Guillaume Gomez
00bf8717e3 Add GUI test for item info elements color 2024-12-28 20:54:00 +01:00