rustdoc: fix fallout from removing ast::Sigil.

This commit is contained in:
Eduard Burtescu 2014-04-09 15:34:35 +03:00
parent 0ac532686f
commit 9351c01b35
2 changed files with 17 additions and 14 deletions
src/librustdoc

View File

@ -474,8 +474,6 @@ impl Clean<Item> for doctree::Function {
#[deriving(Clone, Encodable, Decodable)]
pub struct ClosureDecl {
pub sigil: ast::Sigil,
pub region: Option<Lifetime>,
pub lifetimes: Vec<Lifetime>,
pub decl: FnDecl,
pub onceness: ast::Onceness,
@ -486,8 +484,6 @@ pub struct ClosureDecl {
impl Clean<ClosureDecl> for ast::ClosureTy {
fn clean(&self) -> ClosureDecl {
ClosureDecl {
sigil: self.sigil,
region: self.region.clean(),
lifetimes: self.lifetimes.clean().move_iter().collect(),
decl: self.decl.clean(),
onceness: self.onceness,
@ -652,7 +648,8 @@ pub enum Type {
Self(ast::NodeId),
/// Primitives are just the fixed-size numeric types (plus int/uint/float), and char.
Primitive(ast::PrimTy),
Closure(~ClosureDecl),
Closure(~ClosureDecl, Option<Lifetime>),
Proc(~ClosureDecl),
/// extern "ABI" fn
BareFunction(~BareFunctionDecl),
Tuple(Vec<Type> ),
@ -706,7 +703,8 @@ impl Clean<Type> for ast::Ty {
tpbs.clean().map(|x| x.move_iter().collect()),
id)
}
TyClosure(ref c) => Closure(~c.clean()),
TyClosure(ref c, region) => Closure(~c.clean(), region.clean()),
TyProc(ref c) => Proc(~c.clean()),
TyBareFn(ref barefn) => BareFunction(~barefn.clean()),
TyBot => Bottom,
ref x => fail!("Unimplemented type {:?}", x),

View File

@ -337,19 +337,24 @@ impl fmt::Show for clean::Type {
};
f.buf.write(s.as_bytes())
}
clean::Closure(ref decl) => {
let region = match decl.region {
clean::Closure(ref decl, ref region) => {
let region = match *region {
Some(ref region) => format!("{} ", *region),
None => ~"",
};
write!(f.buf, "{}{}{arrow, select, yes{ -&gt; {ret}} other{}}",
write!(f.buf, "{}{}|{}|{arrow, select, yes{ -&gt; {ret}} other{}}",
FnStyleSpace(decl.fn_style),
match decl.sigil {
ast::OwnedSigil => format!("proc({})", decl.decl.inputs),
ast::BorrowedSigil => format!("{}|{}|", region, decl.decl.inputs),
ast::ManagedSigil => format!("@{}fn({})", region, decl.decl.inputs),
},
region,
decl.decl.inputs,
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
ret = decl.decl.output)
// FIXME: where are bounds and lifetimes printed?!
}
clean::Proc(ref decl) => {
write!(f.buf, "{}proc({}){arrow, select, yes{ -&gt; {ret}} other{}}",
FnStyleSpace(decl.fn_style),
decl.decl.inputs,
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
ret = decl.decl.output)
// FIXME: where are bounds and lifetimes printed?!