diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-09-28 20:00:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-28 20:00:17 +0200 |
| commit | 96ce45793710487d6abb628ee513329466af7aed (patch) | |
| tree | 9f49e708de91cf9cc0b0a7f665de4d1d22f96eab | |
| parent | 48b5d110ae8b0917d09b71cdcfa6e5107a4fc224 (diff) | |
| parent | 88ff75c6ccd44e6eef20157cbedfa15dc0f6a1b2 (diff) | |
| download | rust-96ce45793710487d6abb628ee513329466af7aed.tar.gz rust-96ce45793710487d6abb628ee513329466af7aed.zip | |
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
| -rw-r--r-- | src/librustdoc/json/mod.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-json/unions/impl.rs | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 5089cc30a1e..915a9fd2b89 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -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()); diff --git a/src/test/rustdoc-json/unions/impl.rs b/src/test/rustdoc-json/unions/impl.rs new file mode 100644 index 00000000000..0388b4a8c3c --- /dev/null +++ b/src/test/rustdoc-json/unions/impl.rs @@ -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 {} |
