diff --git a/src/librustdoc/astsrv.rs b/src/librustdoc/astsrv.rs index c222ad10025..cdfc13e4fa7 100644 --- a/src/librustdoc/astsrv.rs +++ b/src/librustdoc/astsrv.rs @@ -40,10 +40,10 @@ use syntax::diagnostic::handler; use syntax::diagnostic; use syntax; -pub type Ctxt = { +pub struct Ctxt { ast: @ast::crate, ast_map: ast_map::map -}; +} type SrvOwner = fn(srv: Srv) -> T; pub type CtxtHandler = fn~(ctxt: Ctxt) -> T; @@ -54,9 +54,9 @@ enum Msg { Exit } -pub enum Srv = { +pub struct Srv { ch: oldcomm::Chan -}; +} impl Srv: Clone { fn clone(&self) -> Srv { copy *self } @@ -72,11 +72,11 @@ pub fn from_file(file: ~str, owner: SrvOwner) -> T { fn run(owner: SrvOwner, source: ~str, parse: Parser) -> T { - let srv_ = Srv({ + let srv_ = Srv { ch: do util::spawn_listener |copy source, move parse, po| { act(po, copy source, copy parse); } - }); + }; let res = owner(srv_); oldcomm::send(srv_.ch, Exit); @@ -127,7 +127,7 @@ fn build_ctxt(sess: Session, let ast = front::test::modify_for_testing(sess, ast); let ast_map = ast_map::map_crate(sess.diagnostic(), *ast); - { + Ctxt { ast: ast, ast_map: ast_map, } diff --git a/src/librustdoc/attr_parser.rs b/src/librustdoc/attr_parser.rs index 377b6a62c85..afbb10f2cbb 100644 --- a/src/librustdoc/attr_parser.rs +++ b/src/librustdoc/attr_parser.rs @@ -25,9 +25,9 @@ use syntax::attr; use syntax::codemap; use syntax; -pub type CrateAttrs = { +pub struct CrateAttrs { name: Option<~str> -}; +} #[cfg(test)] mod test { @@ -66,7 +66,7 @@ fn doc_metas( pub fn parse_crate(attrs: ~[ast::attribute]) -> CrateAttrs { let link_metas = attr::find_linkage_metas(attrs); - { + CrateAttrs { name: attr::last_meta_item_value_str_by_name(link_metas, ~"name") } } diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 8277ac0e45d..9ba23a20b50 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -104,21 +104,33 @@ pub fn default_config(input_crate: &Path) -> Config { } } -type ProgramOutput = fn~((&str), (&[~str])) -> - {status: int, out: ~str, err: ~str}; +struct ProcOut { + status: int, + out: ~str, + err: ~str +} -pub fn mock_program_output(_prog: &str, _args: &[~str]) -> { - status: int, out: ~str, err: ~str -} { - { +type ProgramOutput = fn~((&str), (&[~str])) -> ProcOut; + +pub fn mock_program_output(_prog: &str, _args: &[~str]) -> ProcOut { + ProcOut { status: 0, out: ~"", err: ~"" } } +pub fn program_output(prog: &str, args: &[~str]) -> ProcOut { + let {status, out, err} = run::program_output(prog, args); + ProcOut { + status: status, + out: out, + err: err + } +} + pub fn parse_config(args: &[~str]) -> Result { - parse_config_(args, run::program_output) + parse_config_(args, program_output) } pub fn parse_config_( @@ -260,10 +272,8 @@ fn should_find_pandoc() { output_format: PandocHtml, .. default_config(&Path("test")) }; - let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> { - status: int, out: ~str, err: ~str - } { - { + let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> ProcOut { + ProcOut { status: 0, out: ~"pandoc 1.8.2.1", err: ~"" } }; @@ -277,10 +287,8 @@ fn should_error_with_no_pandoc() { output_format: PandocHtml, .. default_config(&Path("test")) }; - let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> { - status: int, out: ~str, err: ~str - } { - { + let mock_program_output = fn~(_prog: &str, _args: &[~str]) -> ProcOut { + ProcOut { status: 1, out: ~"", err: ~"" } }; diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index a6be38b4eb4..6bd461d1f92 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -110,9 +110,9 @@ fn should_write_modules_last() { assert idx_a < idx_c; } -type Ctxt = { +struct Ctxt { w: Writer -}; +} pub fn write_markdown( doc: doc::Doc, @@ -122,7 +122,7 @@ pub fn write_markdown( // we don't want to spawn too many pandoc processes. // (See #2484, which is closed.) do doc.pages.map |page| { - let ctxt = { + let ctxt = Ctxt { w: writer_factory(copy *page) }; write_page(&ctxt, page) diff --git a/src/librustdoc/rustdoc.rc b/src/librustdoc/rustdoc.rc index 1aa1edb61a3..9d4469f2077 100644 --- a/src/librustdoc/rustdoc.rc +++ b/src/librustdoc/rustdoc.rc @@ -20,7 +20,6 @@ #[crate_type = "lib"]; #[no_core]; -#[legacy_records]; #[allow(non_implicitly_copyable_typarams)]; #[allow(deprecated_self)];