diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-06-30 00:23:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-30 00:23:51 +0200 |
| commit | 6d6b30ccbf2b99abb14b33dda9c96e478b34a3f3 (patch) | |
| tree | 9c38e77513c0d7044bc326fb506917513c548214 | |
| parent | 48170d5a1ccc4ff1e8a370fb63bd8eb29de92a25 (diff) | |
| parent | ba87c934ea86476bbd75909eb18cbf7627c12c81 (diff) | |
| download | rust-6d6b30ccbf2b99abb14b33dda9c96e478b34a3f3.tar.gz rust-6d6b30ccbf2b99abb14b33dda9c96e478b34a3f3.zip | |
Rollup merge of #98681 - Enselic:rustdoc-json-default-assoc-type-blanket-impl, r=GuillaumeGomez
rustdoc-json: Make default value of blanket impl assoc types work Closes #98658 r? ``@GuillaumeGomez`` ``@rustbot`` labels +A-rustdoc-json
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc-json/blanket_impls.rs | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index afc84cc0a97..316554808c2 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -255,7 +255,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum { AssocTypeItem(t, b) => ItemEnum::AssocType { generics: t.generics.into_tcx(tcx), bounds: b.into_iter().map(|x| x.into_tcx(tcx)).collect(), - default: t.item_type.map(|ty| ty.into_tcx(tcx)), + default: Some(t.item_type.unwrap_or(t.type_).into_tcx(tcx)), }, // `convert_item` early returns `None` for striped items and keywords. StrippedItem(_) | KeywordItem(_) => unreachable!(), diff --git a/src/test/rustdoc-json/blanket_impls.rs b/src/test/rustdoc-json/blanket_impls.rs new file mode 100644 index 00000000000..edf1a9fe2fc --- /dev/null +++ b/src/test/rustdoc-json/blanket_impls.rs @@ -0,0 +1,9 @@ +// Regression test for <https://github.com/rust-lang/rust/issues/98658> + +#![no_std] + +// @has blanket_impls.json +// @has - "$.index[*][?(@.name=='Error')].kind" \"assoc_type\" +// @has - "$.index[*][?(@.name=='Error')].inner.default.kind" \"resolved_path\" +// @has - "$.index[*][?(@.name=='Error')].inner.default.inner.name" \"Infallible\" +pub struct ForBlanketTryFromImpl; |
