Rollup merge of #89867 - Urgau:fix-double-definition, r=GuillaumeGomez
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 https://github.com/rust-lang/rust/issues/89852
This commit is contained in:
commit
0d990a3dbd
3 changed files with 42 additions and 3 deletions
17
src/test/rustdoc-json/reexport/macro.rs
Normal file
17
src/test/rustdoc-json/reexport/macro.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// edition:2018
|
||||
|
||||
#![no_core]
|
||||
#![feature(no_core)]
|
||||
|
||||
// @count macro.json "$.index[*][?(@.name=='macro')].inner.items[*]" 2
|
||||
|
||||
// @set repro_id = macro.json "$.index[*][?(@.name=='repro')].id"
|
||||
// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro_id
|
||||
#[macro_export]
|
||||
macro_rules! repro {
|
||||
() => {};
|
||||
}
|
||||
|
||||
// @set repro2_id = macro.json "$.index[*][?(@.inner.name=='repro2')].id"
|
||||
// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro2_id
|
||||
pub use crate::repro as repro2;
|
||||
14
src/test/rustdoc/issue-89852.rs
Normal file
14
src/test/rustdoc/issue-89852.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// edition:2018
|
||||
|
||||
#![no_core]
|
||||
#![feature(no_core)]
|
||||
|
||||
// @matches 'issue_89852/sidebar-items.js' '"repro"'
|
||||
// @!matches 'issue_89852/sidebar-items.js' '"repro".*"repro"'
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! repro {
|
||||
() => {};
|
||||
}
|
||||
|
||||
pub use crate::repro as repro2;
|
||||
Loading…
Add table
Add a link
Reference in a new issue