Skip to content

Commit 3aef6c6

Browse files
committed
roll another resolution logic in rustdoc
1 parent 30b6fe3 commit 3aef6c6

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

src/librustdoc/clean/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,8 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13811381
ty::Projection(proj) => Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id),
13821382
// Rustdoc handles `ty::Error`s by turning them into `Type::Infer`s.
13831383
ty::Error(_) => return Type::Infer,
1384-
_ => bug!("clean: expected associated type, found `{:?}`", ty),
1384+
// Otherwise, this is an inherent associated type.
1385+
_ => return clean_middle_ty(ty, cx, None),
13851386
};
13861387
let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx);
13871388
register_res(cx, trait_.res);
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// check-pass
12
// This test ensures that rustdoc does not panic on inherented associated types
23
// that are referred to without fully-qualified syntax.
34

@@ -9,8 +10,4 @@ pub struct Struct;
910
impl Struct {
1011
pub type AssocTy = usize;
1112
pub const AssocConst: Self::AssocTy = 42;
12-
//~^ ERROR ambiguous associated type
13-
//~| HELP use fully-qualified syntax
14-
//~| ERROR ambiguous associated type
15-
//~| HELP use fully-qualified syntax
1613
}

src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr

-15
This file was deleted.

0 commit comments

Comments
 (0)