diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-03-26 02:34:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-26 02:34:38 +0100 |
| commit | 0502815529e079676a2ed4c701de2fa0f39ffa51 (patch) | |
| tree | 15c1bdc10d6b22b64287e6eb49240810dabb0359 /src/librustdoc/json | |
| parent | 3debe9acb8df363e0b5363f23f8218c2d7919904 (diff) | |
| parent | d9e2d8d6652fef745a5658178a6f85fc809f6453 (diff) | |
| download | rust-0502815529e079676a2ed4c701de2fa0f39ffa51.tar.gz rust-0502815529e079676a2ed4c701de2fa0f39ffa51.zip | |
Rollup merge of #83055 - aDotInTheVoid:selective-strip-item-doc, r=jyn514
[rustdoc] Don't document stripped items in JSON renderer. Fixes #80664, see [my comment there](https://github.com/rust-lang/rust/issues/80664#issuecomment-797557948) for why Note that we already do something similar in `convert_item`: https://github.com/rust-lang/rust/blob/bb4cdf8ec034dca5c056ec9295f38062e5b7e871/src/librustdoc/json/conversions.rs#L28-L31 ``@rustbot`` modify labels: +T-rustdoc +A-rustdoc-json r? ``@jyn514`` cc ``@CraftSpider``
Diffstat (limited to 'src/librustdoc/json')
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 3 | ||||
| -rw-r--r-- | src/librustdoc/json/mod.rs | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 7516fc1eaa1..c470dc57005 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -198,7 +198,8 @@ fn from_clean_item_kind(item: clean::ItemKind, tcx: TyCtxt<'_>, name: &Option<Sy bounds: g.into_iter().map(|x| x.into_tcx(tcx)).collect(), default: t.map(|x| x.into_tcx(tcx)), }, - StrippedItem(inner) => from_clean_item_kind(*inner, tcx, name), + // `convert_item` early returns `None` for striped items + StrippedItem(_) => unreachable!(), PrimitiveItem(_) | KeywordItem(_) => { panic!("{:?} is not supported for JSON output", item) } diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 6d18dbe67e4..db3a0c5ceb1 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -129,6 +129,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { "json" } + const RUN_ON_MODULE: bool = false; + fn init( krate: clean::Crate, options: RenderOptions, @@ -169,8 +171,10 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { e.impls = self.get_impls(id) } let removed = self.index.borrow_mut().insert(from_def_id(id), new_item.clone()); + // FIXME(adotinthevoid): Currently, the index is duplicated. This is a sanity check - // to make sure the items are unique. + // to make sure the items are unique. The main place this happens is when an item, is + // reexported in more than one place. See `rustdoc-json/reexport/in_root_and_mod` if let Some(old_item) = removed { assert_eq!(old_item, new_item); } |
