Skip to content

Commit 9351c01

Browse files
committed
rustdoc: fix fallout from removing ast::Sigil.
1 parent 0ac5326 commit 9351c01

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/librustdoc/clean.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,6 @@ impl Clean<Item> for doctree::Function {
474474

475475
#[deriving(Clone, Encodable, Decodable)]
476476
pub struct ClosureDecl {
477-
pub sigil: ast::Sigil,
478-
pub region: Option<Lifetime>,
479477
pub lifetimes: Vec<Lifetime>,
480478
pub decl: FnDecl,
481479
pub onceness: ast::Onceness,
@@ -486,8 +484,6 @@ pub struct ClosureDecl {
486484
impl Clean<ClosureDecl> for ast::ClosureTy {
487485
fn clean(&self) -> ClosureDecl {
488486
ClosureDecl {
489-
sigil: self.sigil,
490-
region: self.region.clean(),
491487
lifetimes: self.lifetimes.clean().move_iter().collect(),
492488
decl: self.decl.clean(),
493489
onceness: self.onceness,
@@ -652,7 +648,8 @@ pub enum Type {
652648
Self(ast::NodeId),
653649
/// Primitives are just the fixed-size numeric types (plus int/uint/float), and char.
654650
Primitive(ast::PrimTy),
655-
Closure(~ClosureDecl),
651+
Closure(~ClosureDecl, Option<Lifetime>),
652+
Proc(~ClosureDecl),
656653
/// extern "ABI" fn
657654
BareFunction(~BareFunctionDecl),
658655
Tuple(Vec<Type> ),
@@ -706,7 +703,8 @@ impl Clean<Type> for ast::Ty {
706703
tpbs.clean().map(|x| x.move_iter().collect()),
707704
id)
708705
}
709-
TyClosure(ref c) => Closure(~c.clean()),
706+
TyClosure(ref c, region) => Closure(~c.clean(), region.clean()),
707+
TyProc(ref c) => Proc(~c.clean()),
710708
TyBareFn(ref barefn) => BareFunction(~barefn.clean()),
711709
TyBot => Bottom,
712710
ref x => fail!("Unimplemented type {:?}", x),

src/librustdoc/html/format.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,24 @@ impl fmt::Show for clean::Type {
337337
};
338338
f.buf.write(s.as_bytes())
339339
}
340-
clean::Closure(ref decl) => {
341-
let region = match decl.region {
340+
clean::Closure(ref decl, ref region) => {
341+
let region = match *region {
342342
Some(ref region) => format!("{} ", *region),
343343
None => ~"",
344344
};
345345

346-
write!(f.buf, "{}{}{arrow, select, yes{ -&gt; {ret}} other{}}",
346+
write!(f.buf, "{}{}|{}|{arrow, select, yes{ -&gt; {ret}} other{}}",
347347
FnStyleSpace(decl.fn_style),
348-
match decl.sigil {
349-
ast::OwnedSigil => format!("proc({})", decl.decl.inputs),
350-
ast::BorrowedSigil => format!("{}|{}|", region, decl.decl.inputs),
351-
ast::ManagedSigil => format!("@{}fn({})", region, decl.decl.inputs),
352-
},
348+
region,
349+
decl.decl.inputs,
350+
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
351+
ret = decl.decl.output)
352+
// FIXME: where are bounds and lifetimes printed?!
353+
}
354+
clean::Proc(ref decl) => {
355+
write!(f.buf, "{}proc({}){arrow, select, yes{ -&gt; {ret}} other{}}",
356+
FnStyleSpace(decl.fn_style),
357+
decl.decl.inputs,
353358
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
354359
ret = decl.decl.output)
355360
// FIXME: where are bounds and lifetimes printed?!

0 commit comments

Comments
 (0)