Skip to content

Commit f6a52ad

Browse files
committed
---
yaml --- r: 36399 b: refs/heads/try2 c: 4156641 h: refs/heads/master i: 36397: bd1a2da 36395: 9006419 36391: a73e601 36383: d9946b1 v: v3
1 parent 8cbbcc2 commit f6a52ad

20 files changed

+198
-191
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 145e02347e88176e342631033abb748c51db45e8
8+
refs/heads/try2: 415664181b04574a5dfa553a54efb4df7924c15f
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/src/librustdoc/astsrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub type Ctxt = {
2828

2929
type SrvOwner<T> = fn(srv: Srv) -> T;
3030
pub type CtxtHandler<T> = fn~(ctxt: Ctxt) -> T;
31-
type Parser = fn~(Session, ~str) -> @ast::crate;
31+
type Parser = fn~(Session, +s: ~str) -> @ast::crate;
3232

3333
enum Msg {
3434
HandleRequest(fn~(Ctxt)),

branches/try2/src/librustdoc/attr_parser.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub type CrateAttrs = {
1717
mod test {
1818
#[legacy_exports];
1919

20-
fn parse_attributes(source: ~str) -> ~[ast::attribute] {
20+
fn parse_attributes(+source: ~str) -> ~[ast::attribute] {
2121
use syntax::parse;
2222
use parse::parser;
2323
use parse::attr::parser_attr;
@@ -33,7 +33,7 @@ mod test {
3333
}
3434
3535
fn doc_metas(
36-
attrs: ~[ast::attribute]
36+
+attrs: ~[ast::attribute]
3737
) -> ~[@ast::meta_item] {
3838
3939
let doc_attrs = attr::find_attrs_by_name(attrs, ~"doc");
@@ -44,7 +44,7 @@ fn doc_metas(
4444
return doc_metas;
4545
}
4646

47-
pub fn parse_crate(attrs: ~[ast::attribute]) -> CrateAttrs {
47+
pub fn parse_crate(+attrs: ~[ast::attribute]) -> CrateAttrs {
4848
let link_metas = attr::find_linkage_metas(attrs);
4949

5050
{
@@ -76,7 +76,7 @@ fn should_not_extract_crate_name_if_no_name_value_in_link_attribute() {
7676
assert attrs.name == None;
7777
}
7878

79-
pub fn parse_desc(attrs: ~[ast::attribute]) -> Option<~str> {
79+
pub fn parse_desc(+attrs: ~[ast::attribute]) -> Option<~str> {
8080
let doc_strs = do doc_metas(attrs).filter_map |meta| {
8181
attr::get_meta_item_value_str(*meta)
8282
};
@@ -103,7 +103,7 @@ fn parse_desc_should_parse_simple_doc_attributes() {
103103
assert attrs == Some(~"basic");
104104
}
105105

106-
pub fn parse_hidden(attrs: ~[ast::attribute]) -> bool {
106+
pub fn parse_hidden(+attrs: ~[ast::attribute]) -> bool {
107107
do doc_metas(attrs).find |meta| {
108108
match attr::get_meta_item_list(meta) {
109109
Some(metas) => {

branches/try2/src/librustdoc/attr_pass.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn mk_pass() -> Pass {
2121

2222
fn run(
2323
srv: astsrv::Srv,
24-
doc: doc::Doc
24+
+doc: doc::Doc
2525
) -> doc::Doc {
2626
let fold = fold::Fold({
2727
fold_crate: fold_crate,
@@ -31,12 +31,12 @@ fn run(
3131
fold_impl: fold_impl,
3232
.. *fold::default_any_fold(srv)
3333
});
34-
fold.fold_doc(fold, doc)
34+
fold.fold_doc(&fold, doc)
3535
}
3636

3737
fn fold_crate(
38-
fold: fold::Fold<astsrv::Srv>,
39-
doc: doc::CrateDoc
38+
fold: &fold::Fold<astsrv::Srv>,
39+
+doc: doc::CrateDoc
4040
) -> doc::CrateDoc {
4141

4242
let srv = fold.ctxt;
@@ -65,8 +65,8 @@ fn should_replace_top_module_name_with_crate_name() {
6565
}
6666

6767
fn fold_item(
68-
fold: fold::Fold<astsrv::Srv>,
69-
doc: doc::ItemDoc
68+
fold: &fold::Fold<astsrv::Srv>,
69+
+doc: doc::ItemDoc
7070
) -> doc::ItemDoc {
7171

7272
let srv = fold.ctxt;
@@ -90,7 +90,7 @@ fn fold_item(
9090
fn parse_item_attrs<T:Send>(
9191
srv: astsrv::Srv,
9292
id: doc::AstId,
93-
+parse_attrs: fn~(~[ast::attribute]) -> T) -> T {
93+
+parse_attrs: fn~(+a: ~[ast::attribute]) -> T) -> T {
9494
do astsrv::exec(srv) |move parse_attrs, ctxt| {
9595
let attrs = match ctxt.ast_map.get(id) {
9696
ast_map::node_item(item, _) => item.attrs,
@@ -132,8 +132,8 @@ fn should_extract_fn_attributes() {
132132
}
133133

134134
fn fold_enum(
135-
fold: fold::Fold<astsrv::Srv>,
136-
doc: doc::EnumDoc
135+
fold: &fold::Fold<astsrv::Srv>,
136+
+doc: doc::EnumDoc
137137
) -> doc::EnumDoc {
138138

139139
let srv = fold.ctxt;
@@ -183,8 +183,8 @@ fn should_extract_variant_docs() {
183183
}
184184
185185
fn fold_trait(
186-
fold: fold::Fold<astsrv::Srv>,
187-
doc: doc::TraitDoc
186+
fold: &fold::Fold<astsrv::Srv>,
187+
+doc: doc::TraitDoc
188188
) -> doc::TraitDoc {
189189
let srv = fold.ctxt;
190190
let doc = fold::default_seq_fold_trait(fold, doc);
@@ -259,8 +259,8 @@ fn should_extract_trait_method_docs() {
259259

260260

261261
fn fold_impl(
262-
fold: fold::Fold<astsrv::Srv>,
263-
doc: doc::ImplDoc
262+
fold: &fold::Fold<astsrv::Srv>,
263+
+doc: doc::ImplDoc
264264
) -> doc::ImplDoc {
265265
let srv = fold.ctxt;
266266
let doc = fold::default_seq_fold_impl(fold, doc);

branches/try2/src/librustdoc/config.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use result::Result;
22
use std::getopts;
3+
use std::cell::Cell;
34

45
/// The type of document to output
56
pub enum OutputFormat {
@@ -115,21 +116,21 @@ fn mock_program_output(_prog: &str, _args: &[~str]) -> {
115116
}
116117
}
117118

118-
fn parse_config(args: ~[~str]) -> Result<Config, ~str> {
119+
fn parse_config(args: &[~str]) -> Result<Config, ~str> {
119120
parse_config_(args, run::program_output)
120121
}
121122

122123
fn parse_config_(
123-
args: ~[~str],
124-
program_output: ProgramOutput
124+
args: &[~str],
125+
+program_output: ProgramOutput
125126
) -> Result<Config, ~str> {
126127
let args = vec::tail(args);
127128
let opts = vec::unzip(opts()).first();
128129
match getopts::getopts(args, opts) {
129130
result::Ok(matches) => {
130131
if vec::len(matches.free) == 1u {
131132
let input_crate = Path(vec::head(matches.free));
132-
config_from_opts(&input_crate, matches, program_output)
133+
config_from_opts(&input_crate, matches, move program_output)
133134
} else if vec::is_empty(matches.free) {
134135
result::Err(~"no crates specified")
135136
} else {
@@ -144,8 +145,8 @@ fn parse_config_(
144145

145146
fn config_from_opts(
146147
input_crate: &Path,
147-
matches: getopts::Matches,
148-
program_output: ProgramOutput
148+
+matches: getopts::Matches,
149+
+program_output: ProgramOutput
149150
) -> Result<Config, ~str> {
150151

151152
let config = default_config(input_crate);
@@ -187,10 +188,11 @@ fn config_from_opts(
187188
}
188189
}
189190
};
191+
let program_output = Cell(move program_output);
190192
let result = do result::chain(result) |config| {
191193
let pandoc_cmd = getopts::opt_maybe_str(matches, opt_pandoc_cmd());
192194
let pandoc_cmd = maybe_find_pandoc(
193-
config, pandoc_cmd, program_output);
195+
&config, pandoc_cmd, move program_output.take());
194196
do result::chain(pandoc_cmd) |pandoc_cmd| {
195197
result::Ok({
196198
pandoc_cmd: pandoc_cmd,
@@ -201,26 +203,26 @@ fn config_from_opts(
201203
return result;
202204
}
203205

204-
fn parse_output_format(output_format: ~str) -> Result<OutputFormat, ~str> {
205-
match output_format {
206+
fn parse_output_format(output_format: &str) -> Result<OutputFormat, ~str> {
207+
match output_format.to_str() {
206208
~"markdown" => result::Ok(Markdown),
207209
~"html" => result::Ok(PandocHtml),
208210
_ => result::Err(fmt!("unknown output format '%s'", output_format))
209211
}
210212
}
211213

212-
fn parse_output_style(output_style: ~str) -> Result<OutputStyle, ~str> {
213-
match output_style {
214+
fn parse_output_style(output_style: &str) -> Result<OutputStyle, ~str> {
215+
match output_style.to_str() {
214216
~"doc-per-crate" => result::Ok(DocPerCrate),
215217
~"doc-per-mod" => result::Ok(DocPerMod),
216218
_ => result::Err(fmt!("unknown output style '%s'", output_style))
217219
}
218220
}
219221

220222
fn maybe_find_pandoc(
221-
config: Config,
222-
maybe_pandoc_cmd: Option<~str>,
223-
program_output: ProgramOutput
223+
config: &Config,
224+
+maybe_pandoc_cmd: Option<~str>,
225+
+program_output: ProgramOutput
224226
) -> Result<Option<~str>, ~str> {
225227
if config.output_format != PandocHtml {
226228
return result::Ok(maybe_pandoc_cmd);
@@ -264,7 +266,7 @@ fn should_find_pandoc() {
264266
status: 0, out: ~"pandoc 1.8.2.1", err: ~""
265267
}
266268
};
267-
let result = maybe_find_pandoc(config, None, mock_program_output);
269+
let result = maybe_find_pandoc(&config, None, move mock_program_output);
268270
assert result == result::Ok(Some(~"pandoc"));
269271
}
270272

@@ -281,14 +283,14 @@ fn should_error_with_no_pandoc() {
281283
status: 1, out: ~"", err: ~""
282284
}
283285
};
284-
let result = maybe_find_pandoc(config, None, mock_program_output);
286+
let result = maybe_find_pandoc(&config, None, move mock_program_output);
285287
assert result == result::Err(~"couldn't find pandoc");
286288
}
287289

288290
#[cfg(test)]
289291
mod test {
290292
#[legacy_exports];
291-
fn parse_config(args: ~[~str]) -> Result<Config, ~str> {
293+
fn parse_config(args: &[~str]) -> Result<Config, ~str> {
292294
parse_config_(args, mock_program_output)
293295
}
294296
}

branches/try2/src/librustdoc/desc_to_brief_pass.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ pub fn mk_pass() -> Pass {
1616

1717
fn run(
1818
_srv: astsrv::Srv,
19-
doc: doc::Doc
19+
+doc: doc::Doc
2020
) -> doc::Doc {
2121
let fold = fold::Fold({
2222
fold_item: fold_item,
2323
fold_trait: fold_trait,
2424
fold_impl: fold_impl,
2525
.. *fold::default_any_fold(())
2626
});
27-
fold.fold_doc(fold, doc)
27+
fold.fold_doc(&fold, doc)
2828
}
2929

30-
fn fold_item(fold: fold::Fold<()>, doc: doc::ItemDoc) -> doc::ItemDoc {
30+
fn fold_item(fold: &fold::Fold<()>, +doc: doc::ItemDoc) -> doc::ItemDoc {
3131
let doc = fold::default_seq_fold_item(fold, doc);
3232

3333
{
@@ -36,7 +36,7 @@ fn fold_item(fold: fold::Fold<()>, doc: doc::ItemDoc) -> doc::ItemDoc {
3636
}
3737
}
3838

39-
fn fold_trait(fold: fold::Fold<()>, doc: doc::TraitDoc) -> doc::TraitDoc {
39+
fn fold_trait(fold: &fold::Fold<()>, +doc: doc::TraitDoc) -> doc::TraitDoc {
4040
let doc =fold::default_seq_fold_trait(fold, doc);
4141

4242
{
@@ -48,7 +48,7 @@ fn fold_trait(fold: fold::Fold<()>, doc: doc::TraitDoc) -> doc::TraitDoc {
4848
}
4949
}
5050

51-
fn fold_impl(fold: fold::Fold<()>, doc: doc::ImplDoc) -> doc::ImplDoc {
51+
fn fold_impl(fold: &fold::Fold<()>, +doc: doc::ImplDoc) -> doc::ImplDoc {
5252
let doc =fold::default_seq_fold_impl(fold, doc);
5353

5454
{

0 commit comments

Comments
 (0)