Skip to content

Commit 1f52652

Browse files
committed
rustc: Eliminate some indirection to the syntax crate
1 parent a2572fe commit 1f52652

22 files changed

+49
-77
lines changed

src/cargo/cargo.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use core(vers = "0.2");
2323
use std(vers = "0.2");
2424
use rustc(vers = "0.2");
25+
use syntax(name = "rustsyntax", vers = "0.2");
2526

2627
import core::*;
2728

src/cargo/cargo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// cargo.rs - Rust package manager
22

3-
import rustc::syntax::{ast, codemap};
4-
import rustc::syntax::parse;
3+
import syntax::{ast, codemap};
4+
import syntax::parse;
55
import rustc::util::filesearch::{get_cargo_root, get_cargo_root_nearest,
66
get_cargo_sysroot, libdir};
7-
import rustc::driver::diagnostic;
7+
import syntax::diagnostic;
88

99
import result::{ok, err};
1010
import io::writer_util;

src/fuzzer/fuzzer.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use core(vers = "0.2");
88
use std(vers = "0.2");
9-
use rustc(vers = "0.2");
9+
use syntax(name = "rustsyntax", vers = "0.2");
1010

1111
import core::*;
1212

src/fuzzer/fuzzer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import io::writer_util;
22

3-
import rustc::syntax::{ast, ast_util, fold, visit, codemap};
4-
import rustc::syntax::parse;
5-
import rustc::syntax::print::pprust;
6-
import rustc::driver::diagnostic;
3+
import syntax::{ast, ast_util, fold, visit, codemap};
4+
import syntax::parse;
5+
import syntax::print::pprust;
6+
import syntax::diagnostic;
77

88
enum test_mode { tm_converge, tm_run, }
99
type context = { mode: test_mode }; // + rng

src/rustc/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import rustsyntax::diagnostic;
1+
import syntax::diagnostic;
22
export diagnostic;
33

44
export driver;

src/rustc/driver/rustc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use core(vers = "0.2");
44
use std(vers = "0.2");
55
use rustc(vers = "0.2");
6+
use syntax(name = "rustsyntax", vers = "0.2");
67

78
import core::*;
89

@@ -12,7 +13,7 @@ import std::getopts;
1213
import std::map::hashmap;
1314
import getopts::{opt_present};
1415
import rustc::driver::driver::*;
15-
import rustc::syntax::codemap;
16+
import syntax::codemap;
1617
import rustc::driver::diagnostic;
1718
import rustc::middle::lint;
1819
import io::reader_util;

src/rustc/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod back {
4545
mod driver {
4646
import session = driver_::session;
4747
export session;
48-
import diagnostic = rustsyntax::diagnostic;
48+
import diagnostic = syntax::diagnostic;
4949
export diagnostic;
5050
}
5151

src/rustc/metadata/astencode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn decode_inlined_item(cdata: cstore::crate_metadata,
103103
alt ii {
104104
ast::ii_item(i) {
105105
#debug(">>> DECODED ITEM >>>\n%s\n<<< DECODED ITEM <<<",
106-
rustsyntax::print::pprust::item_to_str(i));
106+
syntax::print::pprust::item_to_str(i));
107107
}
108108
_ { }
109109
}

src/rustc/rustc.rc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use core(vers = "0.2");
1515
use std(vers = "0.2");
16-
use rustsyntax(vers = "0.2");
16+
use syntax(name = "rustsyntax", vers = "0.2");
1717

1818
import core::*;
1919

@@ -82,8 +82,6 @@ mod middle {
8282
}
8383
}
8484

85-
mod syntax;
86-
8785
mod front {
8886
mod config;
8987
mod test;

src/rustc/syntax.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/rustdoc/astsrv.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import std::map::hashmap;
1111
import rustc::driver::session;
1212
import rustc::driver::driver;
13-
import rustc::driver::diagnostic;
14-
import rustc::driver::diagnostic::handler;
15-
import rustc::syntax::ast;
16-
import rustc::syntax::codemap;
13+
import syntax::diagnostic;
14+
import syntax::diagnostic::handler;
15+
import syntax::ast;
16+
import syntax::codemap;
1717
import rustc::middle::ast_map;
1818
import rustc::back::link;
1919
import rustc::util::filesearch;

src/rustdoc/attr_parser.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
an AST's attributes."
66
)];
77

8-
import rustc::syntax::ast;
9-
import rustc::syntax::attr;
8+
import syntax::ast;
9+
import syntax::attr;
1010
import core::tuple;
1111

1212
export crate_attrs;
@@ -21,10 +21,10 @@ type crate_attrs = {
2121
mod test {
2222

2323
fn parse_attributes(source: str) -> [ast::attribute] {
24-
import rustc::syntax::parse;
25-
import rustc::syntax::parse::parser;
26-
import rustc::syntax::codemap;
27-
import rustc::driver::diagnostic;
24+
import syntax::parse;
25+
import parse::parser;
26+
import syntax::codemap;
27+
import syntax::diagnostic;
2828

2929
let cm = codemap::new_codemap();
3030
let handler = diagnostic::mk_handler(none);

src/rustdoc/attr_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
of the natural-language documentation for a crate."
77
)];
88

9-
import rustc::syntax::ast;
9+
import syntax::ast;
1010
import rustc::middle::ast_map;
1111
import std::map::hashmap;
1212

src/rustdoc/extract.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[doc = "Converts the Rust AST to the rustdoc document model"];
22

3-
import rustc::syntax::ast;
3+
import syntax::ast;
44

55
export from_srv, extract;
66

src/rustdoc/markdown_pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ fn write_header_(ctxt: ctxt, lvl: hlvl, title: str) {
180180
fn header_kind(doc: doc::itemtag) -> str {
181181
alt doc {
182182
doc::modtag(_) {
183-
if doc.id() == rustc::syntax::ast::crate_node_id {
183+
if doc.id() == syntax::ast::crate_node_id {
184184
"Crate"
185185
} else {
186186
"Module"
@@ -216,7 +216,7 @@ fn header_kind(doc: doc::itemtag) -> str {
216216
fn header_name(doc: doc::itemtag) -> str {
217217
let fullpath = str::connect(doc.path() + [doc.name()], "::");
218218
alt doc {
219-
doc::modtag(_) if doc.id() != rustc::syntax::ast::crate_node_id {
219+
doc::modtag(_) if doc.id() != syntax::ast::crate_node_id {
220220
fullpath
221221
}
222222
doc::nmodtag(_) {

src/rustdoc/page_pass.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ modules, pages for the crate, indexes, etc.
77
88
"];
99

10+
import syntax::ast;
11+
1012
export mk_pass;
1113

1214
fn mk_pass(output_style: config::output_style) -> pass {
@@ -92,7 +94,7 @@ fn fold_mod(
9294

9395
let doc = fold::default_any_fold_mod(fold, doc);
9496

95-
if doc.id() != rustc::syntax::ast::crate_node_id {
97+
if doc.id() != ast::crate_node_id {
9698

9799
let doc = strip_mod(doc);
98100
let page = doc::itempage(doc::modtag(doc));

src/rustdoc/parse.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import rustc::driver::driver;
44
import driver::{file_input, str_input};
55
import rustc::driver::session;
6-
import rustc::driver::diagnostic;
7-
import rustc::syntax::ast;
8-
import rustc::syntax::codemap;
9-
import rustc::syntax::parse;
6+
import syntax::diagnostic;
7+
import syntax::ast;
8+
import syntax::codemap;
9+
import syntax::parse;
1010

1111
export from_file, from_str, from_file_sess, from_str_sess;
1212

src/rustdoc/path_pass.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#[doc = "Records the full path to items"];
22

3+
import syntax::ast;
4+
35
export mk_pass;
46

57
fn mk_pass() -> pass {
@@ -36,7 +38,7 @@ fn fold_item(fold: fold::fold<ctxt>, doc: doc::itemdoc) -> doc::itemdoc {
3638
}
3739

3840
fn fold_mod(fold: fold::fold<ctxt>, doc: doc::moddoc) -> doc::moddoc {
39-
let is_topmod = doc.id() == rustc::syntax::ast::crate_node_id;
41+
let is_topmod = doc.id() == ast::crate_node_id;
4042

4143
if !is_topmod { vec::push(fold.ctxt.path, doc.name()); }
4244
let doc = fold::default_any_fold_mod(fold, doc);

src/rustdoc/prune_unexported_pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[doc = "Prunes branches of the tree that are not exported"];
22

3-
import rustc::syntax::ast;
4-
import rustc::syntax::ast_util;
3+
import syntax::ast;
4+
import syntax::ast_util;
55
import rustc::middle::ast_map;
66
import std::map::hashmap;
77

src/rustdoc/reexport_pass.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import std::map;
44
import std::map::hashmap;
55
import std::list;
6-
import rustc::syntax::ast;
7-
import rustc::syntax::ast_util;
6+
import syntax::ast;
7+
import syntax::ast_util;
88
import rustc::util::common;
99
import rustc::middle::ast_map;
10-
import rustc::syntax::visit;
11-
import rustc::syntax::codemap;
10+
import syntax::visit;
11+
import syntax::codemap;
1212
import rustc::middle::resolve;
1313

1414
export mk_pass;
@@ -316,7 +316,7 @@ fn merge_reexports(
316316
fn fold_mod(fold: fold::fold<path_map>, doc: doc::moddoc) -> doc::moddoc {
317317
let doc = fold::default_seq_fold_mod(fold, doc);
318318

319-
let is_topmod = doc.id() == rustc::syntax::ast::crate_node_id;
319+
let is_topmod = doc.id() == ast::crate_node_id;
320320

321321
// In the case of the top mod, it really doesn't have a name;
322322
// the name we have here is actually the crate name

src/rustdoc/rustdoc.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use core(vers = "0.2");
1515
use std(vers = "0.2");
1616
use rustc(vers = "0.2");
17+
use syntax(name = "rustsyntax", vers = "0.2");
1718

1819
import core::*;
1920

src/rustdoc/tystr_pass.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#[doc =
22
"Pulls type information out of the AST and attaches it to the document"];
33

4-
import rustc::syntax::ast;
5-
import rustc::syntax::print::pprust;
4+
import syntax::ast;
5+
import syntax::print::pprust;
66
import rustc::middle::ast_map;
77
import std::map::hashmap;
88

0 commit comments

Comments
 (0)