From de94f0affb6e8f700ce1e9c67a9572c9f262a5fa Mon Sep 17 00:00:00 2001 From: Tom Jakubowski Date: Thu, 20 Nov 2014 21:45:05 -0800 Subject: [PATCH] rustdoc: render ast::QPath Fix #18594 --- src/librustdoc/clean/mod.rs | 16 ++++++++++++++++ src/librustdoc/html/format.rs | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 3228c32a73393..5985516a559f3 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1135,6 +1135,11 @@ pub enum Type { mutability: Mutability, type_: Box, }, + QPath { + name: String, + self_type: Box, + trait_: Box + }, // region, raw, other boxes, mutable } @@ -1260,6 +1265,7 @@ impl Clean for ast::Ty { TyProc(ref c) => Proc(box c.clean(cx)), TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)), TyParen(ref ty) => ty.clean(cx), + TyQPath(ref qp) => qp.clean(cx), ref x => panic!("Unimplemented type {}", x), } } @@ -1362,6 +1368,16 @@ impl<'tcx> Clean for ty::Ty<'tcx> { } } +impl Clean for ast::QPath { + fn clean(&self, cx: &DocContext) -> Type { + Type::QPath { + name: self.item_name.clean(cx), + self_type: box self.self_type.clean(cx), + trait_: box self.trait_ref.clean(cx) + } + } +} + #[deriving(Clone, Encodable, Decodable)] pub enum StructField { HiddenStructField, // inserted later by strip passes diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 221caa64ef569..43aef11ce5c2f 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -485,6 +485,9 @@ impl fmt::Show for clean::Type { } } } + clean::QPath { ref name, ref self_type, ref trait_ } => { + write!(f, "<{} as {}>::{}", self_type, trait_, name) + } clean::Unique(..) => { panic!("should have been cleaned") }