From 9351c01b3576f32206b80b32a03b66be66f18b39 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Wed, 9 Apr 2014 15:34:35 +0300 Subject: [PATCH] rustdoc: fix fallout from removing ast::Sigil. --- src/librustdoc/clean.rs | 10 ++++------ src/librustdoc/html/format.rs | 21 +++++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index 7430c7ccb49..32a61fcca07 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -474,8 +474,6 @@ impl Clean for doctree::Function { #[deriving(Clone, Encodable, Decodable)] pub struct ClosureDecl { - pub sigil: ast::Sigil, - pub region: Option, pub lifetimes: Vec, pub decl: FnDecl, pub onceness: ast::Onceness, @@ -486,8 +484,6 @@ pub struct ClosureDecl { impl Clean 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), + Proc(~ClosureDecl), /// extern "ABI" fn BareFunction(~BareFunctionDecl), Tuple(Vec ), @@ -706,7 +703,8 @@ impl Clean 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), diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 9daa135647f..66edbf82017 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -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{ -> {ret}} other{}}", + write!(f.buf, "{}{}|{}|{arrow, select, yes{ -> {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{ -> {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?!