diff options
| author | bors <bors@rust-lang.org> | 2021-10-18 09:52:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-18 09:52:13 +0000 |
| commit | 09c42c45858d5f3aedfa670698275303a3d19afa (patch) | |
| tree | 079a1e62911df8b2cbdb36319a133b41ae8094d0 /src | |
| parent | 7eda9439636b4b56c74349b7309aff8109702e86 (diff) | |
| parent | 7b9189aef301bd0e6cb2ec50835d3ce15eee051f (diff) | |
| download | rust-1.56.0.tar.gz rust-1.56.0.zip | |
Auto merge of #90004 - pietroalbini:stable-next, r=pietroalbini 1.56.0
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 * #89867 r? `@ghost` cc `@rust-lang/release`
Diffstat (limited to 'src')
| -rw-r--r-- | src/ci/channel | 2 | ||||
| -rw-r--r-- | src/librustdoc/visit_ast.rs | 14 | ||||
| -rw-r--r-- | src/test/rustdoc-json/reexport/macro.rs | 17 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-89852.rs | 14 |
4 files changed, 43 insertions, 4 deletions
diff --git a/src/ci/channel b/src/ci/channel index 65b2df87f7d..2bf5ad0447d 100644 --- a/src/ci/channel +++ b/src/ci/channel @@ -1 +1 @@ -beta +stable diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 897b9140fc8..5082a14da2c 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -86,13 +86,21 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { // the rexport defines the path that a user will actually see. Accordingly, // we add the rexport as an item here, and then skip over the original // definition in `visit_item()` below. + // + // We also skip `#[macro_export] macro_rules!` that have already been inserted, + // it can happen if within the same module a `#[macro_export] macro_rules!` + // is declared but also a reexport of itself producing two exports of the same + // macro in the same module. + let mut inserted = FxHashSet::default(); for export in self.cx.tcx.module_exports(CRATE_DEF_ID).unwrap_or(&[]) { if let Res::Def(DefKind::Macro(_), def_id) = export.res { if let Some(local_def_id) = def_id.as_local() { if self.cx.tcx.has_attr(def_id, sym::macro_export) { - let hir_id = self.cx.tcx.hir().local_def_id_to_hir_id(local_def_id); - let item = self.cx.tcx.hir().expect_item(hir_id); - top_level_module.items.push((item, None)); + if inserted.insert(def_id) { + let hir_id = self.cx.tcx.hir().local_def_id_to_hir_id(local_def_id); + let item = self.cx.tcx.hir().expect_item(hir_id); + top_level_module.items.push((item, None)); + } } } } diff --git a/src/test/rustdoc-json/reexport/macro.rs b/src/test/rustdoc-json/reexport/macro.rs new file mode 100644 index 00000000000..b86614ffbad --- /dev/null +++ b/src/test/rustdoc-json/reexport/macro.rs @@ -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; diff --git a/src/test/rustdoc/issue-89852.rs b/src/test/rustdoc/issue-89852.rs new file mode 100644 index 00000000000..45544dbeea6 --- /dev/null +++ b/src/test/rustdoc/issue-89852.rs @@ -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; |
