roll another resolution logic in rustdoc
This commit is contained in:
parent
30b6fe37a6
commit
3aef6c6a54
3 changed files with 3 additions and 20 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue