Skip to content

Commit ba87c93

Browse files
committed
rustdoc-json: Make default value of blanket impl assoc types work
1 parent 116edb6 commit ba87c93

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/librustdoc/json/conversions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
255255
AssocTypeItem(t, b) => ItemEnum::AssocType {
256256
generics: t.generics.into_tcx(tcx),
257257
bounds: b.into_iter().map(|x| x.into_tcx(tcx)).collect(),
258-
default: t.item_type.map(|ty| ty.into_tcx(tcx)),
258+
default: Some(t.item_type.unwrap_or(t.type_).into_tcx(tcx)),
259259
},
260260
// `convert_item` early returns `None` for striped items and keywords.
261261
StrippedItem(_) | KeywordItem(_) => unreachable!(),
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Regression test for <https://github.com/rust-lang/rust/issues/98658>
2+
3+
#![no_std]
4+
5+
// @has blanket_impls.json
6+
// @has - "$.index[*][?(@.name=='Error')].kind" \"assoc_type\"
7+
// @has - "$.index[*][?(@.name=='Error')].inner.default.kind" \"resolved_path\"
8+
// @has - "$.index[*][?(@.name=='Error')].inner.default.inner.name" \"Infallible\"
9+
pub struct ForBlanketTryFromImpl;

0 commit comments

Comments
 (0)