Skip to content

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

Merged
bors merged 6 commits into
rust-lang:masterfrom
Urgau:fix-double-definition
Oct 19, 2021
Merged

Fix macro_rules! duplication when reexported in the same module#89867
bors merged 6 commits into
rust-lang:masterfrom
Urgau:fix-double-definition

Conversation

@Urgau

@Urgau Urgau commented Oct 14, 2021

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

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.

Comment thread src/librustdoc/visit_ast.rs Outdated
@camelid camelid added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 14, 2021
Comment thread src/librustdoc/visit_ast.rs Outdated
Comment thread src/librustdoc/visit_ast.rs Outdated
Comment thread src/test/rustdoc-json/reexport/macro.rs
Comment thread src/librustdoc/visit_ast.rs Outdated
Urgau and others added 2 commits October 15, 2021 12:21
Comment thread src/test/rustdoc/issue-89852.rs Outdated
Comment thread src/test/rustdoc/issue-89852.rs Outdated
Comment on lines +6 to +7
// @matches 'issue_89852/sidebar-items.js' '"repro"'
// @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"'

Copy link
Copy Markdown
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?

@Urgau Urgau Oct 15, 2021

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

@bors: r+

@bors

bors commented Oct 18, 2021

Copy link
Copy Markdown
Collaborator

📌 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
@emilyalbini emilyalbini 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