Skip to content

Commit

Permalink
rustdoc-json: Make default value of blanket impl assoc types work
Browse files Browse the repository at this point in the history
  • Loading branch information
Enselic committed Jun 29, 2022
1 parent 116edb6 commit ba87c93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(),
Expand Down
9 changes: 9 additions & 0 deletions src/test/rustdoc-json/blanket_impls.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit ba87c93

Please sign in to comment.