Skip to content

Commit a4817fa

Browse files
committed
---
yaml --- r: 39635 b: refs/heads/incoming c: 47cd1e4 h: refs/heads/master i: 39633: 27ea39d 39631: ed0e000 v: v3
1 parent 03e1f41 commit a4817fa

21 files changed

+162
-36
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 624421aa3d5d09fd59834c524f1909120685232d
9+
refs/heads/incoming: 47cd1e4fc8e8f3cdab7d8b5864a8f2733c016cd4
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/librustc/middle/resolve.rs

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,11 +2086,8 @@ impl Resolver {
20862086
match self.resolve_import_for_module(module_, import_directive) {
20872087
Failed => {
20882088
// We presumably emitted an error. Continue.
2089-
let idents = import_directive.module_path.get();
2090-
let msg = fmt!("failed to resolve import: %s",
2091-
self.import_path_to_str(idents,
2092-
*import_directive.subclass));
2093-
self.session.span_err(import_directive.span, msg);
2089+
self.session.span_err(import_directive.span,
2090+
~"failed to resolve import");
20942091
}
20952092
Indeterminate => {
20962093
// Bail out. We'll come around next time.
@@ -2106,29 +2103,20 @@ impl Resolver {
21062103
}
21072104

21082105
fn idents_to_str(idents: ~[ident]) -> ~str {
2109-
let ident_strs = idents.map(|&ident| self.session.str_of(ident));
2110-
return str::connect(ident_strs, "::");
2111-
}
2112-
2113-
fn import_directive_subclass_to_str(subclass: ImportDirectiveSubclass)
2114-
-> ~str {
2115-
match subclass {
2116-
SingleImport(_target, source, _ns) => self.session.str_of(source),
2117-
GlobImport => ~"*"
2118-
}
2119-
}
2120-
2121-
fn import_path_to_str(idents: ~[ident], subclass: ImportDirectiveSubclass)
2122-
-> ~str {
2123-
if idents.is_empty() {
2124-
self.import_directive_subclass_to_str(subclass)
2125-
} else {
2126-
fmt!("%s::%s",
2127-
self.idents_to_str(idents),
2128-
self.import_directive_subclass_to_str(subclass))
2129-
}
2106+
// XXX: str::connect should do this.
2107+
let mut result = ~"";
2108+
let mut first = true;
2109+
for idents.each() |ident| {
2110+
if first {
2111+
first = false;
2112+
} else {
2113+
result += ~"::";
2114+
}
2115+
result += self.session.str_of(*ident);
2116+
}
2117+
// XXX: Shouldn't copy here. We need string builder functionality.
2118+
return result;
21302119
}
2131-
21322120
/**
21332121
* Attempts to resolve the given import. The return value indicates
21342122
* failure if we're certain the name does not exist, indeterminate if we
@@ -4513,14 +4501,17 @@ impl Resolver {
45134501
// Write the result into the def map.
45144502
debug!("(resolving type) writing resolution for `%s` \
45154503
(id %d)",
4516-
self.idents_to_str(path.idents),
4504+
connect(path.idents.map(
4505+
|x| self.session.str_of(*x)), ~"::"),
45174506
path_id);
45184507
self.record_def(path_id, def);
45194508
}
45204509
None => {
45214510
self.session.span_err
45224511
(ty.span, fmt!("use of undeclared type name `%s`",
4523-
self.idents_to_str(path.idents)));
4512+
connect(path.idents.map(
4513+
|x| self.session.str_of(*x)),
4514+
~"::")));
45244515
}
45254516
}
45264517
}
@@ -4714,7 +4705,9 @@ impl Resolver {
47144705
self.session.span_err(
47154706
path.span,
47164707
fmt!("`%s` does not name a structure",
4717-
self.idents_to_str(path.idents)));
4708+
connect(path.idents.map(
4709+
|x| self.session.str_of(*x)),
4710+
~"::")));
47184711
}
47194712
}
47204713
}
@@ -5110,11 +5103,14 @@ impl Resolver {
51105103
Some(def) => {
51115104
// Write the result into the def map.
51125105
debug!("(resolving expr) resolved `%s`",
5113-
self.idents_to_str(path.idents));
5106+
connect(path.idents.map(
5107+
|x| self.session.str_of(*x)), ~"::"));
51145108
self.record_def(expr.id, def);
51155109
}
51165110
None => {
5117-
let wrong_name = self.idents_to_str(path.idents);
5111+
let wrong_name =
5112+
connect(path.idents.map(
5113+
|x| self.session.str_of(*x)), ~"::") ;
51185114
if self.name_exists_in_scope_struct(wrong_name) {
51195115
self.session.span_err(expr.span,
51205116
fmt!("unresolved name: `%s`. \
@@ -5174,7 +5170,9 @@ impl Resolver {
51745170
self.session.span_err(
51755171
path.span,
51765172
fmt!("`%s` does not name a structure",
5177-
self.idents_to_str(path.idents)));
5173+
connect(path.idents.map(
5174+
|x| self.session.str_of(*x)),
5175+
~"::")));
51785176
}
51795177
}
51805178

@@ -5493,7 +5491,7 @@ impl Resolver {
54935491
// hit.
54945492
//
54955493

5496-
/// A somewhat inefficient routine to obtain the name of a module.
5494+
/// A somewhat inefficient routine to print out the name of a module.
54975495
fn module_to_str(module_: @Module) -> ~str {
54985496
let idents = DVec();
54995497
let mut current_module = module_;
@@ -5516,7 +5514,22 @@ impl Resolver {
55165514
if idents.len() == 0 {
55175515
return ~"???";
55185516
}
5519-
return self.idents_to_str(vec::reversed(idents.get()));
5517+
5518+
let mut string = ~"";
5519+
let mut i = idents.len() - 1;
5520+
loop {
5521+
if i < idents.len() - 1 {
5522+
string += ~"::";
5523+
}
5524+
string += self.session.str_of(idents.get_elt(i));
5525+
5526+
if i == 0 {
5527+
break;
5528+
}
5529+
i -= 1;
5530+
}
5531+
5532+
return string;
55205533
}
55215534

55225535
fn dump_module(module_: @Module) {

branches/incoming/src/librustdoc/astsrv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use parse;
2121
use util;
2222

2323
use core::oldcomm;
24+
use core::vec;
2425
use rustc::back::link;
2526
use rustc::driver::driver;
2627
use rustc::driver::session::Session;

branches/incoming/src/librustdoc/attr_parser.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ pub type CrateAttrs = {
3131
mod test {
3232
#[legacy_exports];
3333

34+
use syntax::ast;
35+
use syntax;
36+
3437
fn parse_attributes(+source: ~str) -> ~[ast::attribute] {
3538
use syntax::parse;
3639
use syntax::parse::parser;

branches/incoming/src/librustdoc/attr_pass.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ fn should_extract_impl_method_docs() {
310310
#[cfg(test)]
311311
mod test {
312312
#[legacy_exports];
313+
314+
use astsrv;
315+
use doc;
316+
use extract;
317+
313318
fn mk_doc(source: ~str) -> doc::Doc {
314319
do astsrv::from_str(source) |srv| {
315320
let doc = extract::from_srv(srv, ~"");

branches/incoming/src/librustdoc/desc_to_brief_pass.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ fn should_promote_impl_method_desc() {
100100
#[cfg(test)]
101101
mod test {
102102
#[legacy_exports];
103+
104+
use astsrv;
105+
use attr_pass;
106+
use doc;
107+
use extract;
108+
103109
fn mk_doc(source: ~str) -> doc::Doc {
104110
do astsrv::from_str(source) |srv| {
105111
let doc = extract::from_srv(srv, ~"");

branches/incoming/src/librustdoc/extract.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ fn should_extract_struct_fields() {
344344
mod test {
345345
#[legacy_exports];
346346

347+
use astsrv;
348+
use doc;
349+
use parse;
350+
351+
use core::vec;
352+
347353
fn mk_doc(+source: ~str) -> doc::Doc {
348354
let ast = parse::from_str(source);
349355
extract(ast, ~"")

branches/incoming/src/librustdoc/fold.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use astsrv;
1112
use doc;
13+
use extract;
14+
use parse;
1215

1316
use core::vec;
1417
use std::par;

branches/incoming/src/librustdoc/markdown_index_pass.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ fn should_index_foreign_mod_contents() {
252252
#[cfg(test)]
253253
mod test {
254254
#[legacy_exports];
255+
256+
use astsrv;
257+
use attr_pass;
258+
use config;
259+
use desc_to_brief_pass;
260+
use doc;
261+
use extract;
262+
use path_pass;
263+
255264
fn mk_doc(output_style: config::OutputStyle, +source: ~str) -> doc::Doc {
256265
do astsrv::from_str(source) |srv| {
257266
let config = {

branches/incoming/src/librustdoc/markdown_pass.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,28 @@
1111
//! Generate markdown from a document tree
1212
1313
use astsrv;
14+
use attr_pass;
15+
use config;
16+
use desc_to_brief_pass;
1417
use doc::ItemUtils;
1518
use doc;
19+
use extract;
1620
use fold;
21+
use markdown_index_pass;
1722
use markdown_pass;
1823
use markdown_writer::Writer;
1924
use markdown_writer::WriterUtils;
2025
use markdown_writer::WriterFactory;
26+
use markdown_writer;
27+
use page_pass;
28+
use path_pass;
29+
use sectionalize_pass;
2130
use sort_pass;
31+
use trim_pass;
32+
use unindent_pass;
2233

34+
use core::iter;
35+
use core::oldcomm;
2336
use core::str;
2437
use core::vec;
2538
use std::par;
@@ -817,6 +830,24 @@ fn should_write_struct_header() {
817830
#[cfg(test)]
818831
mod test {
819832
#[legacy_exports];
833+
834+
use astsrv;
835+
use attr_pass;
836+
use config;
837+
use desc_to_brief_pass;
838+
use doc;
839+
use extract;
840+
use markdown_index_pass;
841+
use markdown_writer;
842+
use path_pass;
843+
use sectionalize_pass;
844+
use trim_pass;
845+
use tystr_pass;
846+
use unindent_pass;
847+
848+
use core::oldcomm;
849+
use core::str;
850+
820851
fn render(+source: ~str) -> ~str {
821852
let (srv, doc) = create_doc_srv(source);
822853
let markdown = write_markdown_str_srv(srv, doc);

branches/incoming/src/librustdoc/markdown_writer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ fn should_name_mod_file_names_by_path() {
267267
#[cfg(test)]
268268
mod test {
269269
#[legacy_exports];
270+
271+
use astsrv;
272+
use doc;
273+
use extract;
274+
use path_pass;
275+
270276
fn mk_doc(+name: ~str, +source: ~str) -> doc::Doc {
271277
do astsrv::from_str(source) |srv| {
272278
let doc = extract::from_srv(srv, name);

branches/incoming/src/librustdoc/page_pass.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ fn should_remove_foreign_mods_from_containing_mods() {
183183
#[cfg(test)]
184184
mod test {
185185
#[legacy_exports];
186+
187+
use astsrv;
188+
use config;
189+
use doc;
190+
use extract;
191+
186192
fn mk_doc_(
187193
output_style: config::OutputStyle,
188194
source: ~str

branches/incoming/src/librustdoc/pass.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use astsrv;
1212
use doc;
13+
use extract;
1314

1415
use core::vec;
1516

branches/incoming/src/librustdoc/path_pass.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use astsrv;
1414
use doc::ItemUtils;
1515
use doc;
16+
use extract;
1617
use fold::Fold;
1718
use fold;
1819

branches/incoming/src/librustdoc/prune_hidden_pass.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ fn should_prune_hidden_items() {
7171
#[cfg(test)]
7272
mod test {
7373
#[legacy_exports];
74+
75+
use astsrv;
76+
use doc;
77+
use extract;
78+
7479
fn mk_doc(source: ~str) -> doc::Doc {
7580
do astsrv::from_str(source) |srv| {
7681
let doc = extract::from_srv(srv, ~"");

branches/incoming/src/librustdoc/prune_private_pass.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use fold::Fold;
1818
use fold;
1919

2020
use core::util;
21+
use core::vec;
2122
use syntax::ast;
2223

2324
export mk_pass;
@@ -75,6 +76,10 @@ fn should_prune_items_without_pub_modifier() {
7576

7677
#[cfg(test)]
7778
mod test {
79+
use astsrv;
80+
use doc;
81+
use extract;
82+
7883
pub fn mk_doc(source: ~str) -> doc::Doc {
7984
do astsrv::from_str(source) |srv| {
8085
let doc = extract::from_srv(srv, ~"");

branches/incoming/src/librustdoc/sectionalize_pass.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@
1111
//! Breaks rustdocs into sections according to their headers
1212
1313
use astsrv;
14+
use attr_pass;
1415
use doc::ItemUtils;
1516
use doc;
17+
use extract;
1618
use fold::Fold;
1719
use fold;
1820

1921
use core::str;
22+
use core::vec;
2023
use std::par;
2124

2225
pub fn mk_pass() -> Pass {

branches/incoming/src/librustdoc/sort_pass.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use astsrv;
1414
use doc::ItemUtils;
1515
use doc;
16+
use extract;
1617
use fold::Fold;
1718
use fold;
1819
use util::NominalOp;

0 commit comments

Comments
 (0)