From 44b489f27a92e7e9662f27bcebb66662f4772247 Mon Sep 17 00:00:00 2001 From: Nixon Enraght-Moony Date: Tue, 9 Aug 2022 15:52:18 +0100 Subject: rustdoc: Mark imported items as retained Fixes a bug where impl of items that were imported from a private module would be striped Fixes #100252 Fixes #100242 --- src/test/rustdoc-json/impls/import_from_private.rs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/rustdoc-json/impls/import_from_private.rs (limited to 'src/test/rustdoc-json/impls') diff --git a/src/test/rustdoc-json/impls/import_from_private.rs b/src/test/rustdoc-json/impls/import_from_private.rs new file mode 100644 index 00000000000..ef4d8aa39f8 --- /dev/null +++ b/src/test/rustdoc-json/impls/import_from_private.rs @@ -0,0 +1,24 @@ +// https://github.com/rust-lang/rust/issues/100252 + +#![feature(no_core)] +#![no_core] + +mod bar { + // @set baz = import_from_private.json "$.index[*][?(@.kind=='struct')].id" + pub struct Baz; + // @set impl = - "$.index[*][?(@.kind=='impl')].id" + impl Baz { + // @set doit = - "$.index[*][?(@.kind=='method')].id" + pub fn doit() {} + } +} + +// @set import = - "$.index[*][?(@.kind=='import')].id" +pub use bar::Baz; + +// FIXME(adotinthevoid): Use hasexact once #99474 lands + +// @has - "$.index[*][?(@.kind=='module')].inner.items[*]" $import +// @is - "$.index[*][?(@.kind=='import')].inner.id" $baz +// @has - "$.index[*][?(@.kind=='struct')].inner.impls[*]" $impl +// @has - "$.index[*][?(@.kind=='impl')].inner.items[*]" $doit -- cgit 1.4.1-3-g733a5