1
Fork 0

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

View file

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

View file

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