Rollup merge of #89276 - Urgau:fix-union-impls, r=GuillaumeGomez

Fix the population of the `union.impls` field

This pull-request fix the population of the `union.impls` field that was forgot when the `Union` type was introduce as a split from the `Struct` type https://github.com/rust-lang/rust/pull/81500.

``@rustbot`` label +T-rustdoc +A-rustdoc-json
This commit is contained in:
Guillaume Gomez 2021-09-28 20:00:17 +02:00 committed by GitHub
commit 96ce457937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -169,6 +169,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
s.impls = self.get_impls(id.expect_def_id())
} else if let types::ItemEnum::Enum(ref mut e) = new_item.inner {
e.impls = self.get_impls(id.expect_def_id())
} else if let types::ItemEnum::Union(ref mut u) = new_item.inner {
u.impls = self.get_impls(id.expect_def_id())
}
let removed = self.index.borrow_mut().insert(from_item_id(id), new_item.clone());

View File

@ -0,0 +1,15 @@
#![no_std]
// @has impl.json "$.index[*][?(@.name=='Ux')].visibility" \"public\"
// @has - "$.index[*][?(@.name=='Ux')].kind" \"union\"
pub union Ux {
a: u32,
b: u64
}
// @has - "$.index[*][?(@.name=='Num')].visibility" \"public\"
// @has - "$.index[*][?(@.name=='Num')].kind" \"trait\"
pub trait Num {}
// @count - "$.index[*][?(@.name=='Ux')].inner.impls" 1
impl Num for Ux {}