Skip to content

Commit

Permalink
rustdoc: render ast::QPath
Browse files Browse the repository at this point in the history
Fix #18594
  • Loading branch information
tomjakubowski committed Nov 24, 2014
1 parent dd4c7c0 commit de94f0a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -1135,6 +1135,11 @@ pub enum Type {
mutability: Mutability,
type_: Box<Type>,
},
QPath {
name: String,
self_type: Box<Type>,
trait_: Box<Type>
},
// region, raw, other boxes, mutable
}

Expand Down Expand Up @@ -1260,6 +1265,7 @@ impl Clean<Type> 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),
}
}
Expand Down Expand Up @@ -1362,6 +1368,16 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
}
}

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)]
pub enum StructField {
HiddenStructField, // inserted later by strip passes
Expand Down
3 changes: 3 additions & 0 deletions src/librustdoc/html/format.rs
Expand Up @@ -485,6 +485,9 @@ impl fmt::Show for clean::Type {
}
}
}
clean::QPath { ref name, ref self_type, ref trait_ } => {
write!(f, "&lt;{} as {}&gt;::{}", self_type, trait_, name)
}
clean::Unique(..) => {
panic!("should have been cleaned")
}
Expand Down

5 comments on commit de94f0a

@bors
Copy link
Contributor

@bors bors commented on de94f0a Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at tomjakubowski@de94f0a

@bors
Copy link
Contributor

@bors bors commented on de94f0a Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging tomjakubowski/rust/rustdoc-assoc-types = de94f0a into auto

@bors
Copy link
Contributor

@bors bors commented on de94f0a Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tomjakubowski/rust/rustdoc-assoc-types = de94f0a merged ok, testing candidate = 48ca6d1

@bors
Copy link
Contributor

@bors bors commented on de94f0a Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on de94f0a Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 48ca6d1

Please sign in to comment.