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

Fix macro_rules! duplication when reexported in the same module #89867

Merged
merged 6 commits into from
Oct 19, 2021

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Oct 14, 2021

This can append if within the same module a #[macro_export] macro_rules!
is declared but also a reexport of itself producing two export of the same
macro in the same module. In that case we only want to document it once.

Before:

Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
        Id("0:3"),   // duplicate, same as above
    ],
}

After:

Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
    ],
}

Fixes #89852

Urgau added 2 commits October 14, 2021 01:51
This can append if within the same module a `#[macro_export] macro_rules!`
is declared but also a reexport of itself producing two export of the same
macro in the same module. In that case we only want to document it once.
@rust-highfive
Copy link
Collaborator

r? @ollie27

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 14, 2021
@rust-log-analyzer

This comment has been minimized.

@camelid camelid added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 14, 2021
src/librustdoc/visit_ast.rs Outdated Show resolved Hide resolved
Comment on lines +6 to +7
// @matches 'issue_89852/sidebar-items.js' '"repro"'
// @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"'
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't repro2 be showing up in the sidebar as well?

Copy link
Member Author

@Urgau Urgau Oct 15, 2021

Choose a reason for hiding this comment

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

Maybe, but this would be a pre-existing issue that my PR does not try to solve.

Copy link
Member

Choose a reason for hiding this comment

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

Can't you use count instead to ensure there is only 1 repro? I'm really not a big fan of negative checks.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe, but this would be a pre-existing issue that my PR does not try to solve.

Hmm, I wonder if they are related issues though: #89852 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't you use count instead to ensure there is only 1 repro? I'm really not a big fan of negative checks.

Unfortunately no because it's a javascript and XPath doesn't work on them.

Copy link
Member

Choose a reason for hiding this comment

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

I guess it'll be enough for now then. It would have been much simpler to check using rustdoc-gui though... :-/

@GuillaumeGomez
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Oct 18, 2021

📌 Commit db5b64a has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2021
@pietroalbini pietroalbini added beta-accepted Accepted for backporting to the compiler in the beta channel. beta-nominated Nominated for backporting to the compiler in the beta channel. and removed beta-accepted Accepted for backporting to the compiler in the beta channel. labels Oct 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 18, 2021
Rust 1.56.0 stable release

This PR bumps 1.56.0 to the stable channel. This also includes a backport for:

* Latest changes to the release notes
* rust-lang#89867

r? `@ghost`
cc `@rust-lang/release`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 18, 2021
…laumeGomez

Fix macro_rules! duplication when reexported in the same module

This can append if within the same module a `#[macro_export] macro_rules!`
is declared but also a reexport of itself producing two export of the same
macro in the same module. In that case we only want to document it once.

Before:
```
Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
        Id("0:3"),   // duplicate, same as above
    ],
}
```

After:
```
Module {
    is_crate: true,
    items: [
        Id("0:4"),   // pub use crate::repro as repro2;
        Id("0:3"),   // macro_rules! repro
    ],
}
```

Fixes rust-lang#89852
This was referenced Oct 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 19, 2021
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#89766 (RustWrapper: adapt for an LLVM API change)
 - rust-lang#89867 (Fix macro_rules! duplication when reexported in the same module)
 - rust-lang#89941 (removing TLS support in x86_64-unknown-none-hermitkernel)
 - rust-lang#89956 (Suggest a case insensitive match name regardless of levenshtein distance)
 - rust-lang#89988 (Do not promote values with const drop that need to be dropped)
 - rust-lang#89997 (Add test for issue rust-lang#84957 - `str.as_bytes()` in a `const` expression)
 - rust-lang#90002 (:arrow_up: rust-analyzer)
 - rust-lang#90034 (Tiny tweak to Iterator::unzip() doc comment example.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0d990a3 into rust-lang:master Oct 19, 2021
@rustbot rustbot added this to the 1.58.0 milestone Oct 19, 2021
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.58.0, 1.57.0 Oct 22, 2021
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 22, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 22, 2021
…ulacrum

[beta] backports

*  Don't emit a warning for empty rmeta files. rust-lang#90072
*  Erase late-bound regions before computing vtable debuginfo name. rust-lang#90050
*  Fix wrong niche calculation when 2+ niches are placed at the start rust-lang#90040
*  Revert rust-lang#86011 to fix an incorrect bound check rust-lang#90025
*  Fix macro_rules! duplication when reexported in the same module rust-lang#89867
* Bump cargo to include rust-lang/cargo#9979 - Fix fetching git repos after a force push.

r? `@Mark-Simulacrum`
@Urgau Urgau deleted the fix-double-definition branch May 5, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rustdoc regression: duplicate macro in sidebar
10 participants