Fix populate of union.impls

This commit is contained in:
Loïc BRANSTETT 2021-09-26 18:22:07 +02:00
parent f6e6ddc09d
commit 88ff75c6cc
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 {}