Skip to content

Commit

Permalink
Fix populate of union.impls
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Sep 26, 2021
1 parent f6e6ddc commit 88ff75c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustdoc/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
15 changes: 15 additions & 0 deletions src/test/rustdoc-json/unions/impl.rs
Original file line number Diff line number Diff line change
@@ -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 {}

0 comments on commit 88ff75c

Please sign in to comment.