about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/clean/mod.rs3
-rw-r--r--src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs5
-rw-r--r--src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr15
3 files changed, 3 insertions, 20 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index ad4ad4104e1..7a77aedbccf 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -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);
diff --git a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs
index e58bba64058..94ea0e93bf6 100644
--- a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs
+++ b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.rs
@@ -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.
 
@@ -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
 }
diff --git a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr b/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr
deleted file mode 100644
index b963b722f66..00000000000
--- a/src/test/rustdoc-ui/ambiguous-inherent-assoc-ty.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0223]: ambiguous associated type
-  --> $DIR/ambiguous-inherent-assoc-ty.rs:11:27
-   |
-LL |     pub const AssocConst: Self::AssocTy = 42;
-   |                           ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<Struct as Trait>::AssocTy`
-
-error[E0223]: ambiguous associated type
-  --> $DIR/ambiguous-inherent-assoc-ty.rs:11:27
-   |
-LL |     pub const AssocConst: Self::AssocTy = 42;
-   |                           ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<Struct as Trait>::AssocTy`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0223`.