Skip to content

Commit de94f0a

Browse files
committed
rustdoc: render ast::QPath
Fix #18594
1 parent dd4c7c0 commit de94f0a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/librustdoc/clean/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,11 @@ pub enum Type {
11351135
mutability: Mutability,
11361136
type_: Box<Type>,
11371137
},
1138+
QPath {
1139+
name: String,
1140+
self_type: Box<Type>,
1141+
trait_: Box<Type>
1142+
},
11381143
// region, raw, other boxes, mutable
11391144
}
11401145

@@ -1260,6 +1265,7 @@ impl Clean<Type> for ast::Ty {
12601265
TyProc(ref c) => Proc(box c.clean(cx)),
12611266
TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
12621267
TyParen(ref ty) => ty.clean(cx),
1268+
TyQPath(ref qp) => qp.clean(cx),
12631269
ref x => panic!("Unimplemented type {}", x),
12641270
}
12651271
}
@@ -1362,6 +1368,16 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
13621368
}
13631369
}
13641370

1371+
impl Clean<Type> for ast::QPath {
1372+
fn clean(&self, cx: &DocContext) -> Type {
1373+
Type::QPath {
1374+
name: self.item_name.clean(cx),
1375+
self_type: box self.self_type.clean(cx),
1376+
trait_: box self.trait_ref.clean(cx)
1377+
}
1378+
}
1379+
}
1380+
13651381
#[deriving(Clone, Encodable, Decodable)]
13661382
pub enum StructField {
13671383
HiddenStructField, // inserted later by strip passes

src/librustdoc/html/format.rs

+3
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,9 @@ impl fmt::Show for clean::Type {
485485
}
486486
}
487487
}
488+
clean::QPath { ref name, ref self_type, ref trait_ } => {
489+
write!(f, "&lt;{} as {}&gt;::{}", self_type, trait_, name)
490+
}
488491
clean::Unique(..) => {
489492
panic!("should have been cleaned")
490493
}

0 commit comments

Comments
 (0)