Skip to content

Commit 5cfc7ce

Browse files
committed
librustdoc: revert use of def_id for one of the edge case
Signed-off-by: Muhammad Falak R Wani <[email protected]>
1 parent d468418 commit 5cfc7ce

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/librustdoc/html/render/cache.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ crate fn get_real_types<'tcx>(
257257
tcx: TyCtxt<'_>,
258258
ty: Type,
259259
mut generics: Vec<TypeWithKind>,
260-
cache: &Cache,
260+
_cache: &Cache,
261261
) {
262262
let is_full_generic = ty.is_full_generic();
263263

@@ -309,7 +309,7 @@ crate fn get_real_types<'tcx>(
309309
// We remove the name of the full generic because we have no use for it.
310310
index_ty.name = Some(String::new());
311311
res.push(TypeWithKind::from((index_ty, ItemType::Generic)));
312-
} else if let Some(kind) = ty.def_id(cache).map(|did| tcx.def_kind(did).into()) {
312+
} else if let Some(kind) = ty.def_id_no_primitives().map(|did| tcx.def_kind(did).into()) {
313313
res.push(TypeWithKind::from((index_ty, kind)));
314314
} else if ty.is_primitive() {
315315
// This is a primitive, let's store it as such.
@@ -324,7 +324,9 @@ crate fn get_real_types<'tcx>(
324324

325325
if let Type::Generic(arg_s) = *arg {
326326
if let Some(where_pred) = generics.where_predicates.iter().find(|g| match g {
327-
WherePredicate::BoundPredicate { ty, .. } => ty.def_id(cache) == arg.def_id(cache),
327+
WherePredicate::BoundPredicate { ty, .. } => {
328+
ty.def_id_no_primitives() == arg.def_id_no_primitives()
329+
}
328330
_ => false,
329331
}) {
330332
let mut ty_generics = Vec::new();
@@ -395,7 +397,8 @@ crate fn get_all_types<'tcx>(
395397
// `all_types.extend(args.drain(..));`.
396398
all_types.extend(args);
397399
} else {
398-
if let Some(kind) = arg.type_.def_id(cache).map(|did| tcx.def_kind(did).into()) {
400+
if let Some(kind) = arg.type_.def_id_no_primitives().map(|did| tcx.def_kind(did).into())
401+
{
399402
all_types.push(TypeWithKind::from((get_index_type(&arg.type_, vec![]), kind)));
400403
}
401404
}
@@ -406,7 +409,9 @@ crate fn get_all_types<'tcx>(
406409
FnRetTy::Return(ref return_type) => {
407410
get_real_types(generics, return_type, tcx, 0, &mut ret_types, cache);
408411
if ret_types.is_empty() {
409-
if let Some(kind) = return_type.def_id(cache).map(|did| tcx.def_kind(did).into()) {
412+
if let Some(kind) =
413+
return_type.def_id_no_primitives().map(|did| tcx.def_kind(did).into())
414+
{
410415
ret_types.push(TypeWithKind::from((get_index_type(return_type, vec![]), kind)));
411416
}
412417
}

0 commit comments

Comments
 (0)