Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for macro expansion in rustdoc source code pages #137229

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Feb 18, 2025

This is what it looks like:

Screenshot From 2025-02-18 18-08-51

image

You can test it here. In this case, I also enabled the --generate-link-to-definition to show that both options work well together.

Note: There is a bug currently in firefox where the line numbers are not displayed correctly if they're inside the "macro expansion" span. I didn't open a bug report yet, I plan to do so when I have a bit of time.

r? @notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Feb 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 18, 2025

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @jsha

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

"{closing}\
<span class=expansion>\
<input id={id} type=checkbox>\
<label for={id}>↕</label>{reopening}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done differently than the normal expand/collapse system, but in code and in presentation?

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it would force to duplicate all the common code. For example in:

func(arg, macro!(blabla), arg3);

Only macro!(blabla) will be different, so it's not interesting to duplicate all the rest. Instead, we put the original code in a span, the expanded one in another and then we can simply switch them based on the status of the checked property of the input. I'm also not a big fan of our current details approach as it requires more JS to be working fully as expected but it's a debate for another time.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Feb 21, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 21, 2025

This PR modifies tests/run-make/. If this PR is trying to port a Makefile
run-make test to use rmake.rs, please update the
run-make port tracking issue
so we can track our progress. You can either modify the tracking issue
directly, or you can comment on the tracking issue and link this PR.

cc @jieyouxu

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

I opened the firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=1949948

@bors
Copy link
Contributor

bors commented Feb 24, 2025

☔ The latest upstream changes (presumably #137511) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Feb 26, 2025
@GuillaumeGomez
Copy link
Member Author

PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants