Skip to content

Commit

Permalink
rustdoc: fix fallout from removing ast::Sigil.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Apr 11, 2014
1 parent 0ac5326 commit 9351c01
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
10 changes: 4 additions & 6 deletions src/librustdoc/clean.rs
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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> ),
Expand Down Expand Up @@ -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),
Expand Down
21 changes: 13 additions & 8 deletions src/librustdoc/html/format.rs
Expand Up @@ -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?!
Expand Down

0 comments on commit 9351c01

Please sign in to comment.