Skip to content

Commit d8e51ea

Browse files
committed
Patch rustdoc to include missing types, make the match exhaustive
to prevent such oversights in the future.
1 parent d258d68 commit d8e51ea

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,12 +1165,19 @@ pub enum Type {
11651165
mutability: Mutability,
11661166
type_: Box<Type>,
11671167
},
1168+
1169+
// <Type as Trait>::Name
11681170
QPath {
11691171
name: String,
11701172
self_type: Box<Type>,
11711173
trait_: Box<Type>
11721174
},
1173-
// region, raw, other boxes, mutable
1175+
1176+
// _
1177+
Infer,
1178+
1179+
// for<'a> Foo(&'a)
1180+
PolyTraitRef(Vec<TyParamBound>),
11741181
}
11751182

11761183
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)]
@@ -1307,11 +1314,18 @@ impl Clean<Type> for ast::Ty {
13071314
}
13081315
}
13091316
TyClosure(ref c) => Closure(box c.clean(cx)),
1310-
TyProc(ref c) => Proc(box c.clean(cx)),
13111317
TyBareFn(ref barefn) => BareFunction(box barefn.clean(cx)),
13121318
TyParen(ref ty) => ty.clean(cx),
13131319
TyQPath(ref qp) => qp.clean(cx),
1314-
ref x => panic!("Unimplemented type {}", x),
1320+
TyPolyTraitRef(ref bounds) => {
1321+
PolyTraitRef(bounds.clean(cx))
1322+
},
1323+
TyInfer(..) => {
1324+
Infer
1325+
},
1326+
TyTypeof(..) => {
1327+
panic!("Unimplemented type {}", self.node)
1328+
},
13151329
}
13161330
}
13171331
}

src/librustdoc/html/format.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,16 @@ impl fmt::Show for clean::Type {
390390
try!(resolved_path(f, did, path, false));
391391
tybounds(f, typarams)
392392
}
393+
clean::PolyTraitRef(ref bounds) => {
394+
for (i, bound) in bounds.iter().enumerate() {
395+
if i != 0 {
396+
try!(write!(f, " + "));
397+
}
398+
try!(write!(f, "{}", *bound));
399+
}
400+
Ok(())
401+
}
402+
clean::Infer => write!(f, "_"),
393403
clean::Self(..) => f.write("Self".as_bytes()),
394404
clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()),
395405
clean::Closure(ref decl) => {

0 commit comments

Comments
 (0)