Skip to content

Commit

Permalink
roll another resolution logic in rustdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Nov 3, 2022
1 parent 30b6fe3 commit 3aef6c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,8 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
ty::Projection(proj) => Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id),
// Rustdoc handles `ty::Error`s by turning them into `Type::Infer`s.
ty::Error(_) => return Type::Infer,
_ => bug!("clean: expected associated type, found `{:?}`", ty),
// Otherwise, this is an inherent associated type.
_ => return clean_middle_ty(ty, cx, None),
};
let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx);
register_res(cx, trait_.res);
Expand Down
5 changes: 1 addition & 4 deletions src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// check-pass
// This test ensures that rustdoc does not panic on inherented associated types
// that are referred to without fully-qualified syntax.

Expand All @@ -9,8 +10,4 @@ pub struct Struct;
impl Struct {
pub type AssocTy = usize;
pub const AssocConst: Self::AssocTy = 42;
//~^ ERROR ambiguous associated type
//~| HELP use fully-qualified syntax
//~| ERROR ambiguous associated type
//~| HELP use fully-qualified syntax
}
15 changes: 0 additions & 15 deletions src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr

This file was deleted.

0 comments on commit 3aef6c6

Please sign in to comment.