-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #100325 - aDotInTheVoid:rdj-import-impl, r=GuillaumeG…
…omez Rustdoc-Json: Don't remove impls for items imported from private modules After #99287, items in private modules may still be in the json output, if a public import accesses them. To reflect this, items that are imported need to be marked as retained in the `Stripper` pass, so their impls arn't removed by `ImplStripper`. [More context on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Populating.20cache.2Eimpls), thanks to @ jyn514 for helping debug this. ``@rustbot`` modify labels: +A-rustdoc-json +T-rustdoc r? ``@GuillaumeGomez`` Fixes #100252 Fixes #100242
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |