2

Rustdoc migrate to table so the gui can handle >2k constants by dns2utf8 · Pu...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/88816
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation

Copy link

Contributor

dns2utf8 commented on Sep 10

edited by GuillaumeGomez

Closes #88545.

This PR adds a test for overlapping entries in the item-table #88545
It currently includes the commit with the workaround from #88776

Copy link

Collaborator

rust-highfive commented on Sep 10

r? @ollie27

(rust-highfive has picked a reviewer for you, use r? to override)

Copy link

Contributor

Author

dns2utf8 commented on Sep 10

Copy link

Member

GuillaumeGomez commented on Sep 10

Might be worth it to add a check on test and/or rustdoc hash version to check if we need to rebuild docs or not, even more with this change...

Or maybe we could just create this file once and for all. Not sure what's the best solution here. An opinion @Mark-Simulacrum ?

Copy link

Member

GuillaumeGomez commented on Sep 10

I marked this PR as blocked until #88776 is merged.

Copy link

Contributor

Author

dns2utf8 commented on Sep 11

edited

Might be worth it to add a check on test and/or rustdoc hash version to check if we need to rebuild docs or not, even more with this change...

Do you mean that we only run the tests that have failed or are new? Or about (re-)generating the HTML and such?

Or maybe we could just create this file once and for all. Not sure what's the best solution here. An opinion @Mark-Simulacrum ?

We can store the generated file too, sure

This comment has been hidden.

This comment has been hidden.

dns2utf8

changed the title Rustdoc test gui 2k constants

Rustdoc migrate to table so the gui can handle <2k constants

on Sep 11

dns2utf8

changed the title Rustdoc migrate to table so the gui can handle <2k constants

Rustdoc migrate to table so the gui can handle >2k constants

on Sep 11

Copy link

Contributor

Author

dns2utf8 commented on Sep 11

I implemented both layouts with a table like structure but using <div>s and classes.
The file sizes of the index.html documents have increased by ~10% with this change, so maybe there is some potential there.

dns2utf8

force-pushed the rustdoc_test_gui_2k_constants

branch from 4f36a35 to bca503f last month

Copy link

Member

GuillaumeGomez commented on Sep 12

Oh wow, that's awesome! So just remains to generate a 2000 line file with the constants I guess for the GUI test? :)

Once done, let's merge it, great work, thanks!

Copy link

Member

Mark-Simulacrum commented on Sep 12

Please don't check in a 2000-line generated file, we can generate it at test runtime quickly enough that it shouldn't be necessary to pregenerate and bloat everyone's repository unnecessarily.

the grid-2 spec talks about -10k to +10k cells, it is currently a blink-engine thing to clamp at 1k. In some of their examples I saw them using 1.5k lines so I guessed 2k.

I'd be interested in hearing more about our motivation for adding this test, though. Based on what's been said so far, it sounds like the test is intended to avoid us regressing back to using grids specifically for this feature -- but that seems like the wrong thing to target. In practice, if grids are problematic with large tables -- whether the clamp is at 1000 or 10,000 doesn't seem like it matters that much in practice - then it seems like the better approach is to add a tidy lint preventing their usage in our css files. Obviously, if we know ahead of time that the lint doesn't apply to some statically known small-size user, then we can avoid it in that case. But this would both save on the generation of a 2k line file and the related annoyances (e.g., test run time, etc.) and target the problem more holistically, right?

Copy link

Member

GuillaumeGomez commented on Sep 12

@Mark-Simulacrum Then we need to improve how we run GUI tests because currently we regenerate test docs every time whether or not something was changed. I can do that in a follow-up PR.

Also, @dns2utf8 removed the grid and replaced it with something else, completely fixing the issue.

Copy link

Member

Mark-Simulacrum commented on Sep 12

@Mark-Simulacrum Then we need to improve how we run GUI tests because currently we regenerate test docs every time whether or not something was changed. I can do that in a follow-up PR.

This seems to have nothing to do with my request? I expect each test to either run from scratch or not at all. We can add some caching atop that similar to compiletest, though.

Also, @dns2utf8 removed the grid and replaced it with something else, completely fixing the issue.

Yes, I gathered that. What I'm saying is that testing that we can support 2,000 constants doesn't seem necessary, we can test directly for grid usage and lint against that.

Copy link

Member

GuillaumeGomez commented on Sep 12

Yes, I gathered that. What I'm saying is that testing that we can support 2,000 constants doesn't seem necessary, we can test directly for grid usage and lint against that.

Then I don't understand what you mean.

Copy link

Contributor

Author

dns2utf8 commented on Sep 12

Currently, there is no use of grid layouts in rustdoc and adding a lint that prevents their use could work too for now.

If we decide to use a grid in the future for something else (like switching the layout between super large desktops and 1080p-like desktops) then the check might get removed again. Adding a comment to the lint could reduce that risk again.

Wild idea (maybe a bad one): what if we move some of the tests into a separate folder that is only run at release?

Copy link

Member

Mark-Simulacrum commented on Sep 12

No, we don't want a special category of tests, those just cause pain all around.

Yes, the lint would prevent usage of grids by accident; the reviewer/author could of course justify the usage in specific cases and silence the lint on that particular usage. Tidy lints don't just get dropped, so this would be a reliable way of ensuring we don't make this mistake in the future at very low overhead.

Copy link

Member

GuillaumeGomez commented on Sep 12

I'm very curious on how you want to write such a lint considering all the debate around #86178 (which is still open)...

Copy link

Member

GuillaumeGomez commented on Sep 12

Oh right, I had in mind potential adds through inline CSS (very unlikely) and through JS. Wel, if we don't consider those two, it should be easy enough.

Copy link

Contributor

Author

dns2utf8 commented on Sep 12

A CSS lint seems reasonable.

If we want to keep the long check: what if we reexport some huge module (like one with the arm platform constants) in the test docs and use that for checking?
Or would you just remove this test for now because the table style is very stable I think?

Copy link

Member

JohnCSimon commented 18 days ago

Triage:
@GuillaumeGomez

I marked this PR as blocked until #88776 is merged.

this has been merged

Let's merge this for now then!

Thanks @dns2utf8 !

@bors: r+

Copy link

Contributor

bors commented 18 days ago

pushpin Commit bca503f has been approved by GuillaumeGomez

Copy link

Member

Mark-Simulacrum commented 18 days ago

edited

@bors r=GuillaumeGomez

Squashed the commits down a little.

Copy link

Contributor

bors commented 18 days ago

pushpin Commit e599e2d has been approved by GuillaumeGomez

Copy link

Contributor

Author

dns2utf8 commented 17 days ago

Thank you @Mark-Simulacrum for rebasing it! blush

bors

merged commit 52d3afa into

rust-lang:master 16 days ago

10 checks passed

rustbot

added this to the 1.57.0 milestone

16 days ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Milestone

1.57.0

Linked issues

Successfully merging this pull request may close these issues.

9 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK