提交 de94f0af 编写于 作者: T Tom Jakubowski

rustdoc: render ast::QPath

Fix #18594
上级 dd4c7c00
...@@ -1135,6 +1135,11 @@ pub enum Type { ...@@ -1135,6 +1135,11 @@ pub enum Type {
mutability: Mutability, mutability: Mutability,
type_: Box<Type>, type_: Box<Type>,
}, },
QPath {
name: String,
self_type: Box<Type>,
trait_: Box<Type>
},
// region, raw, other boxes, mutable // region, raw, other boxes, mutable
} }
...@@ -1260,6 +1265,7 @@ fn clean(&self, cx: &DocContext) -> Type { ...@@ -1260,6 +1265,7 @@ fn clean(&self, cx: &DocContext) -> Type {
TyProc(ref c) => Proc(box c.clean(cx)), TyProc(ref c) => Proc(box c.clean(cx)),
TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)), TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
TyParen(ref ty) => ty.clean(cx), TyParen(ref ty) => ty.clean(cx),
TyQPath(ref qp) => qp.clean(cx),
ref x => panic!("Unimplemented type {}", x), ref x => panic!("Unimplemented type {}", x),
} }
} }
...@@ -1362,6 +1368,16 @@ fn clean(&self, cx: &DocContext) -> Type { ...@@ -1362,6 +1368,16 @@ fn clean(&self, cx: &DocContext) -> Type {
} }
} }
impl Clean<Type> 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)] #[deriving(Clone, Encodable, Decodable)]
pub enum StructField { pub enum StructField {
HiddenStructField, // inserted later by strip passes HiddenStructField, // inserted later by strip passes
......
...@@ -485,6 +485,9 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { ...@@ -485,6 +485,9 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
} }
} }
} }
clean::QPath { ref name, ref self_type, ref trait_ } => {
write!(f, "&lt;{} as {}&gt;::{}", self_type, trait_, name)
}
clean::Unique(..) => { clean::Unique(..) => {
panic!("should have been cleaned") panic!("should have been cleaned")
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册