Skip to content

Commit 88ff75c

Browse files
committed
Fix populate of union.impls
1 parent f6e6ddc commit 88ff75c

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/librustdoc/json/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
169169
s.impls = self.get_impls(id.expect_def_id())
170170
} else if let types::ItemEnum::Enum(ref mut e) = new_item.inner {
171171
e.impls = self.get_impls(id.expect_def_id())
172+
} else if let types::ItemEnum::Union(ref mut u) = new_item.inner {
173+
u.impls = self.get_impls(id.expect_def_id())
172174
}
173175
let removed = self.index.borrow_mut().insert(from_item_id(id), new_item.clone());
174176

src/test/rustdoc-json/unions/impl.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![no_std]
2+
3+
// @has impl.json "$.index[*][?(@.name=='Ux')].visibility" \"public\"
4+
// @has - "$.index[*][?(@.name=='Ux')].kind" \"union\"
5+
pub union Ux {
6+
a: u32,
7+
b: u64
8+
}
9+
10+
// @has - "$.index[*][?(@.name=='Num')].visibility" \"public\"
11+
// @has - "$.index[*][?(@.name=='Num')].kind" \"trait\"
12+
pub trait Num {}
13+
14+
// @count - "$.index[*][?(@.name=='Ux')].inner.impls" 1
15+
impl Num for Ux {}

0 commit comments

Comments
 (0)