Commit Graph

429 Commits

Author SHA1 Message Date
Jacob Pratt
d6c2a035c4 Rollup merge of #162030 - GuillaumeGomez:forbid-test-rustdoc-html, r=fmease
Prevent `--test` to be used in `rustdoc-html` testsuite

As [promised](https://github.com/rust-lang/rust/pull/162014#issuecomment-5469387848).

CI will fail until https://github.com/rust-lang/rust/pull/162014 is merged though.

r? @fmease
2026-09-05 23:54:24 -04:00
Guillaume Gomez
d4f576d07d Fix/move newly failing rustdoc tests 2026-09-05 17:24:32 +02:00
Stuart Cook
554577f1a7 Rollup merge of #161602 - GuillaumeGomez:fix-flaky-test, r=Urgau
Fix flakyness issue for `tests/rustdoc-gui/headers-color.goml`

r? @jieyouxu
2026-08-24 14:21:46 +10:00
Guillaume Gomez
2ea2b40f64 Fix flakyness issue for tests/rustdoc-gui/headers-color.goml 2026-08-23 15:51:14 +02:00
Guillaume Gomez
84ba90f00d Unify the "wait search results" approach by reusing the same function 2026-08-22 23:42:24 +02:00
Guillaume Gomez
5e226be7e1 Put back tests/rustdoc-gui/search-result-display.goml 2026-08-22 23:42:24 +02:00
Jacob Pratt
a854bf70c8 Rollup merge of #161409 - GuillaumeGomez:gui-test-back, r=Urgau
Add back `tests/rustdoc-gui/notable-trait.goml` test

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

Mostly the same test, I just replaced the flaky `assert-position` with a `wait-for-position`.

r? @Urgau
2026-08-21 08:43:52 -04:00
Jacob Pratt
b320300197 Rollup merge of #161340 - notriddle:rustdoc-overflow, r=lolbinarycat,GuillaumeGomez
rustdoc: enable scrolling only on table/code

This is a fix for a problem that hit `<ol>`, where the digits were truncated at the edge of the scroll container.

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

<img width="1552" height="923" alt="Screenshot 2026-08-18 at 21 08 12" src="https://github.com/user-attachments/assets/4825a756-0068-42e8-99f2-8a57cc17f234" />

None of this code was written with an LLM, but, supposedly, one was used in the above issue thread for root cause analysis.
2026-08-20 21:34:36 -04:00
Michael Howell
9549cb781c rustdoc: add test case for digit overflow 2026-08-20 09:40:04 -07:00
Guillaume Gomez
d15096be6e Add back tests/rustdoc-gui/notable-trait.goml test 2026-08-20 18:10:01 +02:00
Jonathan Brouwer
2b85223735 Rollup merge of #160639 - GuillaumeGomez:search-dom, r=lolbinarycat
[rustdoc] Only generate search DOM elements if the search is actually needed

I realized that we were generating the search DOM elements (everything contained into `#search`) all the times, even when there is no search query parameters in the URL. That seems unnecessary so I reworked the JS a bit to remove that.

r? @lolbinarycat
2026-08-20 14:45:32 +02:00
Jonathan Brouwer
9692358a86 Rollup merge of #161181 - GuillaumeGomez:rustdoc-flaky-gui-back, r=Urgau
Add back flaky gui rustdoc test `tests/rustdoc-gui/headers-color.goml`

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

This PR adds back `tests/rustdoc-gui/headers-color.goml` with a little tweak: instead of using `go-to` command to change the focused element, we click on the anchors.

r? @Urgau
2026-08-16 22:46:28 +02:00
Jonathan Brouwer
d205f090bc Rollup merge of #161148 - GuillaumeGomez:put-back-gui-test, r=Urgau
[rustdoc] Put back one removed flaky GUI test (which hopefully isn't flaky anymore)

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

You can see the original code of this test in https://github.com/rust-lang/rust/pull/152194 (where it was removed).

The `browser-ui-test` update comes from https://github.com/GuillaumeGomez/browser-UI-test/pull/759. We can now use the `click` command to click on an `option` inside a `select` (surprisingly enough, it needs to be special-cased in puppeteer...).

That update allowed me to replace all the `press-key` with one `click`. Starting from this change, I couldn't reproduce the failure, so hopefully it's gone.

cc @notriddle @JonathanBrouwer

r? @Urgau
2026-08-16 22:46:28 +02:00
Guillaume Gomez
9162595a5a Add back flaky gui rustdoc test tests/rustdoc-gui/headers-color.goml 2026-08-16 17:46:48 +02:00
Guillaume Gomez
7748068e4b Add back flaky rustdoc-gui test with some small tweaks 2026-08-16 00:04:10 +02:00
mejrs
6ef144dcb3 rustdoc: use anonymous constant for primitives/keywords/attribute docs 2026-08-13 14:49:49 +02:00
Jacob Pratt
4debf0889f Rollup merge of #160438 - GuillaumeGomez:table-odd-code, r=notriddle,lolbinarycat
[rustdoc] Change table odd table rows background color to not make it the same as inline code

Fixes rust-lang/rust#159234.
Follow-up of https://github.com/rust-lang/rust/pull/105442.

It now looks like this:

<img width="418" height="163" alt="Screenshot From 2026-08-03 15-21-15" src="https://github.com/user-attachments/assets/97d2ae1c-e167-4cc0-8daf-d8937397faed" />
<img width="418" height="163" alt="Screenshot From 2026-08-03 15-21-21" src="https://github.com/user-attachments/assets/8916a49d-2496-4045-820a-12f10f18d81b" />
<img width="418" height="163" alt="Screenshot From 2026-08-03 15-21-25" src="https://github.com/user-attachments/assets/b44b3b3f-8ec7-4fea-b783-aedf1b452249" />

For the light theme, I had to make the inline code background darker so it would mix well with the alternative table rows background color.

r? @notriddle
2026-08-12 20:17:27 -04:00
Guillaume Gomez
e7e5245db1 Invert table row background 2026-08-12 23:09:20 +02:00
Guillaume Gomez
e647d65faf Change table odd table rows background color to not make it the same as inline code 2026-08-12 22:56:05 +02:00
Guillaume Gomez
730e9a6045 Add comment in tests/rustdoc-gui/sidebar-source-code-display.goml to clarify test 2026-08-12 22:51:41 +02:00
Guillaume Gomez
d83d804257 Add test to ensure that search DOM elements are only generated if needed 2026-08-12 22:51:41 +02:00
Guillaume Gomez
40952ff0c6 Only generate search elements if the search is actually needed 2026-08-12 22:51:40 +02:00
Guillaume Gomez
5dc184c1ae rustdoc: Fix invalid CSS classes generated for notable items 2026-08-11 17:57:15 +02:00
Jacob Pratt
dccf2ca6a0 Rollup merge of #160091 - GuillaumeGomez:rustdoc-toolbar-buttons, r=notriddle
Fix rustdoc toolbar height when title is taller than one line

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

With the fix:

<img width="814" height="238" alt="image" src="https://github.com/user-attachments/assets/5a8edb52-bc6e-44e7-943c-85a73f21e81e" />

r? @notriddle
2026-07-28 20:09:38 -04:00
Guillaume Gomez
e9ca1abeed Add regression test for rustdoc toolbar buttons height 2026-07-28 18:11:54 +02:00
Guillaume Gomez
1d3222031e Add missing "clipboard-read" permission 2026-07-28 11:11:00 +02:00
Jana Dönszelmann
25745ee1f1 fix all tidy annotations 2026-07-13 10:54:53 +02:00
Guillaume Gomez
2262b8e226 Fix bug when rustdoc "go to only result" setting is not working as expected" 2026-06-23 17:12:08 +02:00
Rob
8e9173fc3c librustdoc: update test to fix CSS border issue to support Firefox high contrast mode 2026-06-03 11:05:15 -06:00
Nicholas Nethercote
eef3ae7817 rustdoc: Fix trait impl ordering
For types, rustdoc produces different impl orderings in the sidebar vs.
the main section.

E.g. for `std::cell::UnsafeCell` the "Trait Implementations" sidebar
order is this:
```
!Freeze
!RefUnwindSafe
!Sync
CoerceUnsized<UnsafeCell<U>>
Debug
Default
DispatchFromDyn<UnsafeCell<U>>
From<T>
```
The primary sort is on polarity, and the secondary sort is alphabetical.
Makes sense.

The main section order is this:
```
impl<T> Debug for UnsafeCell<T>
impl<T> Default for UnsafeCell<T>
impl<T> From<T> for UnsafeCell<T>
impl<T, U> CoerceUnsized<UnsafeCell<U>> for UnsafeCell<T>
impl<T, U> DispatchFromDyn<UnsafeCell<U>> for UnsafeCell<T>
impl<T> !Freeze for UnsafeCell<T>
impl<T> !RefUnwindSafe for UnsafeCell<T>
impl<T> !Sync for UnsafeCell<T>
```
This strange ordering occurs because the entries are sorted on the
generated HTML. Impls with methods (the first three) come first because
they start with a `<details>` tag while the others start with a
`<section>` tag. After that, the order depends on a section id of the
form `impl-{trait}-for-{type}` that doesn't include the polarity, which
is why the secondary ordering is alphabetical but ignores the `!`.

The sidebar ordering is the better of the two. This commit changes the
main section to use the same ordering as the sidebar. This involves
creating a new function `impl_trait_key` shared between the two parts.
2026-06-02 13:04:49 +10:00
Nicholas Nethercote
9119e3c2b1 rustdoc: Add a test for trait impl ordering
This shows how the ordering in the sidebar and the main section differ.
The next commit will fix this inconsistency.
2026-06-02 13:04:45 +10:00
Nicholas Nethercote
8fab72f473 rustdoc: Fix comment in sidebar-foreign-impl-sort.goml 2026-06-02 13:01:20 +10:00
Jonathan Brouwer
b0d9ae60e1 Rollup merge of #156401 - shivendra02467:doc-cfg-sort-fix, r=GuillaumeGomez
rustdoc: deterministic sorting for `doc_cfg` badges

Fixes rust-lang/rust#156391

Currently, target-exclusive `doc_cfg` badges (eg. "Available on...") reuse the order of predicates as they appear in the source code. This often buries popular targets behind niche ones and leads to inconsistent UI rendering.

This PR introduces a deterministic sorting mechanism to the `Cfg` AST prior to HTML/JSON rendering.

**Note for Reviewers:**
To provide the best UX, I implemented a lightweight tiering heuristic (prioritizing major platforms like Linux/Apple/Windows first, followed by mobile, then BSDs, and alphabetizing the rest). However, I am completely open to tweaking these priority groupings or falling back to a different sorting logic if the team prefers. Let me know what you think!
2026-05-28 14:59:41 +02:00
Shivendra Sharma
f658bf6bb8 rustdoc: deterministic sorting for doc_cfg badges 2026-05-28 16:15:20 +05:30
Guillaume Gomez
1cbb922c16 Change HTML IDs for attribute macros and attributes
Rename `ItemType::BangMacro*` into `ItemType::DeclMacro*`
Rename `isBangMacro` field into `forceMacroHref`
2026-05-10 02:37:58 +02:00
Guillaume Gomez
d0ff143b06 Correctly generate bang macro declaration in docs for attr/derive kinds 2026-05-10 02:37:58 +02:00
Guillaume Gomez
afcada6d03 Fix link to attr/derive bang macros 2026-05-10 02:37:57 +02:00
Guillaume Gomez
72abf90d22 Deduplicate "attributes" and "attribute macros" sections IDs 2026-05-10 02:37:57 +02:00
Guillaume Gomez
0299472949 Add tests for attribute bang macros in rustdoc 2026-05-10 02:37:57 +02:00
Guillaume Gomez
6c4ec59d5f Tweak how the "copy path" rustdoc button works to allow some accessibility tool to work with rustdoc 2026-04-16 22:06:45 +02:00
binarycat
9bdf217810 rustdoc: seperate methods and associated functions in sidebar 2026-03-31 12:51:12 -05:00
Sasha Pourcelot
9f0944832b rustdoc: add missing target_{os,arch,env} values for cfg pretty printer 2026-03-29 16:02:23 +00:00
Jonathan Brouwer
bce8c00e2f Remove the 4 failing tests from rustdoc-gui 2026-02-06 01:13:41 +01:00
Guillaume Gomez
607ac4bb84 Remove rustdoc GUI flaky test 2026-02-04 17:09:57 +01:00
Guillaume Gomez
4e4192aa48 Try to fix rustdoc-gui/globals.goml flakyness 2026-02-03 16:07:25 +01:00
Guillaume Gomez
9e5820379d Fix flakyness issue with tests/rustdoc-gui/globals.goml test 2026-01-30 11:22:19 +01:00
Stuart Cook
3830f76b4a Rollup merge of #151665 - arferreira:fix-rustdoc-contrast, r=GuillaumeGomez
Fix contrast ratio for `Since` element in rustdoc dark theme

Changed `--right-side-color` from `#808080` to `#ababab` in the dark theme.

<img width="742" height="784" alt="Screenshot 2026-01-25 at 8 04 29 PM" src="https://github.com/user-attachments/assets/38c5f0b9-2034-429f-87db-8a0ed8209b5d" />

Verified visually in dark theme, it's now more readable:

<img width="174" height="96" alt="Screenshot 2026-01-25 at 8 41 02 PM" src="https://github.com/user-attachments/assets/d0c30409-4374-48c4-ae9c-a0aec48e8957" />

Part of https://github.com/rust-lang/rust/issues/59845
Fixes rust-lang/rust#151422
2026-01-29 19:03:32 +11:00
Stuart Cook
f5822b672b Rollup merge of #151559 - GuillaumeGomez:marker-hidden-deprecated-search, r=lolbinarycat
[rustdoc] Add a marker to tell users that there are hidden (deprecated) items in the search results

Someone on mastodon rightfully pointed out that having a visual indication that some search results were hidden would be a good idea if the "hide deprecated items" setting is enabled. In particular if no results are displayed.

It looks like this:

<img width="861" height="228" alt="Screenshot From 2026-01-24 00-26-33" src="https://github.com/user-attachments/assets/93aeef11-a550-47dc-9c78-219ea4fd822c" />

r? @lolbinarycat
2026-01-29 19:03:31 +11:00
Guillaume Gomez
21ebd03e5e Try to reduce rustdoc GUI tests flakyness 2026-01-26 16:18:36 +01:00
Antonio Souza
c7788af89a Fix contrast ratio for Since element in rustodoc dark theme
Signed-off-by: Antonio Souza <arfs.antonio@gmail.com>
2026-01-26 06:53:53 -05:00