-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: Avoid duplicating macros in sidebar #94002
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// This test ensures that there is no macro duplicates in the sidebar. | ||
goto: file://|DOC_PATH|/test_docs/macro.a.html | ||
// Waiting for the elements in the sidebar to be rendered. | ||
wait-for: ".sidebar-elems .others .macro" | ||
// Check there is only one macro named "a" listed in the sidebar. | ||
assert-count: ( | ||
"//*[@class='sidebar-elems']//*[@class='others']/*[@class='block macro']//li/a[text()='a']", | ||
1, | ||
) | ||
// Check there is only one macro named "b" listed in the sidebar. | ||
assert-count: ( | ||
"//*[@class='sidebar-elems']//*[@class='others']/*[@class='block macro']//li/a[text()='b']", | ||
1, | ||
) | ||
Comment on lines
+1
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a regular HTML test using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's generated by the JS, so can't do that. ^^' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is? Somewhat off-topic, but why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering the same thing... Will need to dive into this to understand. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#[macro_export] | ||
macro_rules! a{ () => {}} | ||
#[macro_export] | ||
macro_rules! b{ () => {}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a map to skip duplicates doesn't seem like the correct approach to me. We shouldn't have two macros with the same name in the module in the first place, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible because of reexports. Initially, I had rewrote using a
BTreeMap
but then I discovered that we had an option to keep the declaration order. So I had to revert that and instead using aHashmap
alongside...