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
This commit is contained in:
Matthias Krüger 2022-06-30 00:23:51 +02:00 committed by GitHub
commit 6d6b30ccbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -255,7 +255,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
AssocTypeItem(t, b) => ItemEnum::AssocType { AssocTypeItem(t, b) => ItemEnum::AssocType {
generics: t.generics.into_tcx(tcx), generics: t.generics.into_tcx(tcx),
bounds: b.into_iter().map(|x| x.into_tcx(tcx)).collect(), 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. // `convert_item` early returns `None` for striped items and keywords.
StrippedItem(_) | KeywordItem(_) => unreachable!(), StrippedItem(_) | KeywordItem(_) => unreachable!(),

View File

@ -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;