Patch rustdoc to include missing types, make the match exhaustive
to prevent such oversights in the future.
This commit is contained in:
parent
d258d68db6
commit
d8e51ea0e2
2 changed files with 27 additions and 3 deletions
|
@ -1165,12 +1165,19 @@ pub enum Type {
|
||||||
mutability: Mutability,
|
mutability: Mutability,
|
||||||
type_: Box<Type>,
|
type_: Box<Type>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// <Type as Trait>::Name
|
||||||
QPath {
|
QPath {
|
||||||
name: String,
|
name: String,
|
||||||
self_type: Box<Type>,
|
self_type: Box<Type>,
|
||||||
trait_: Box<Type>
|
trait_: Box<Type>
|
||||||
},
|
},
|
||||||
// region, raw, other boxes, mutable
|
|
||||||
|
// _
|
||||||
|
Infer,
|
||||||
|
|
||||||
|
// for<'a> Foo(&'a)
|
||||||
|
PolyTraitRef(Vec<TyParamBound>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)]
|
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)]
|
||||||
|
@ -1307,11 +1314,18 @@ impl Clean<Type> for ast::Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TyClosure(ref c) => Closure(box c.clean(cx)),
|
TyClosure(ref c) => Closure(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),
|
TyQPath(ref qp) => qp.clean(cx),
|
||||||
ref x => panic!("Unimplemented type {}", x),
|
TyPolyTraitRef(ref bounds) => {
|
||||||
|
PolyTraitRef(bounds.clean(cx))
|
||||||
|
},
|
||||||
|
TyInfer(..) => {
|
||||||
|
Infer
|
||||||
|
},
|
||||||
|
TyTypeof(..) => {
|
||||||
|
panic!("Unimplemented type {}", self.node)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,6 +390,16 @@ impl fmt::Show for clean::Type {
|
||||||
try!(resolved_path(f, did, path, false));
|
try!(resolved_path(f, did, path, false));
|
||||||
tybounds(f, typarams)
|
tybounds(f, typarams)
|
||||||
}
|
}
|
||||||
|
clean::PolyTraitRef(ref bounds) => {
|
||||||
|
for (i, bound) in bounds.iter().enumerate() {
|
||||||
|
if i != 0 {
|
||||||
|
try!(write!(f, " + "));
|
||||||
|
}
|
||||||
|
try!(write!(f, "{}", *bound));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
clean::Infer => write!(f, "_"),
|
||||||
clean::Self(..) => f.write("Self".as_bytes()),
|
clean::Self(..) => f.write("Self".as_bytes()),
|
||||||
clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()),
|
clean::Primitive(prim) => primitive_link(f, prim, prim.to_string()),
|
||||||
clean::Closure(ref decl) => {
|
clean::Closure(ref decl) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue