Assorted fixes from de-modeing rustc/syntax (rusti, rustdoc, fuzzer, rustpkg)
This commit is contained in:
parent
1e4a439f7f
commit
c97bee2696
|
@ -160,7 +160,7 @@ pub fn stash_ty_if(c: @fn(@ast::Ty, test_mode)->bool,
|
|||
|
||||
pub struct StolenStuff {exprs: ~[ast::expr], tys: ~[ast::Ty]}
|
||||
|
||||
pub fn steal(crate: ast::crate, tm: test_mode) -> StolenStuff {
|
||||
pub fn steal(crate: @ast::crate, tm: test_mode) -> StolenStuff {
|
||||
let exprs = @mut ~[];
|
||||
let tys = @mut ~[];
|
||||
let v = visit::mk_simple_visitor(@visit::SimpleVisitor {
|
||||
|
@ -197,7 +197,7 @@ pub fn safe_to_replace_ty(t: &ast::ty_, _tm: test_mode) -> bool {
|
|||
}
|
||||
|
||||
// Replace the |i|th expr (in fold order) of |crate| with |newexpr|.
|
||||
pub fn replace_expr_in_crate(crate: ast::crate, i: uint,
|
||||
pub fn replace_expr_in_crate(crate: @ast::crate, i: uint,
|
||||
newexpr: ast::expr, tm: test_mode) ->
|
||||
ast::crate {
|
||||
let j: @mut uint = @mut 0u;
|
||||
|
@ -222,13 +222,13 @@ pub fn replace_expr_in_crate(crate: ast::crate, i: uint,
|
|||
.. *fold::default_ast_fold()
|
||||
};
|
||||
let af = fold::make_fold(afp);
|
||||
let crate2: @ast::crate = @af.fold_crate(&crate);
|
||||
let crate2: @ast::crate = @af.fold_crate(crate);
|
||||
*crate2
|
||||
}
|
||||
|
||||
|
||||
// Replace the |i|th ty (in fold order) of |crate| with |newty|.
|
||||
pub fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::Ty,
|
||||
pub fn replace_ty_in_crate(crate: @ast::crate, i: uint, newty: ast::Ty,
|
||||
tm: test_mode) -> ast::crate {
|
||||
let j: @mut uint = @mut 0u;
|
||||
fn fold_ty_rep(j_: @mut uint,
|
||||
|
@ -248,7 +248,7 @@ pub fn replace_ty_in_crate(crate: ast::crate, i: uint, newty: ast::Ty,
|
|||
.. *fold::default_ast_fold()
|
||||
};
|
||||
let af = fold::make_fold(afp);
|
||||
let crate2: @ast::crate = @af.fold_crate(&crate);
|
||||
let crate2: @ast::crate = @af.fold_crate(crate);
|
||||
*crate2
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ pub fn as_str(f: @fn(+x: @io::Writer)) -> ~str {
|
|||
io::with_str_writer(f)
|
||||
}
|
||||
|
||||
pub fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
|
||||
pub fn check_variants_of_ast(crate: @ast::crate, codemap: @codemap::CodeMap,
|
||||
filename: &Path, cx: Context) {
|
||||
let stolen = steal(crate, cx.mode);
|
||||
let extra_exprs = do common_exprs().filtered |a| {
|
||||
|
@ -275,13 +275,13 @@ pub fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
|
|||
}
|
||||
|
||||
pub fn check_variants_T<T: Copy>(
|
||||
crate: ast::crate,
|
||||
crate: @ast::crate,
|
||||
codemap: @codemap::CodeMap,
|
||||
filename: &Path,
|
||||
thing_label: ~str,
|
||||
things: ~[T],
|
||||
stringifier: @fn(@T, @syntax::parse::token::ident_interner) -> ~str,
|
||||
replacer: @fn(ast::crate, uint, T, test_mode) -> ast::crate,
|
||||
replacer: @fn(@ast::crate, uint, T, test_mode) -> ast::crate,
|
||||
cx: Context
|
||||
) {
|
||||
error!("%s contains %u %s objects", filename.to_str(),
|
||||
|
@ -323,7 +323,7 @@ pub fn check_variants_T<T: Copy>(
|
|||
last_part(filename.to_str()),
|
||||
thing_label, i, j);
|
||||
let safe_to_run = !(content_is_dangerous_to_run(*str3)
|
||||
|| has_raw_pointers(*crate2));
|
||||
|| has_raw_pointers(crate2));
|
||||
check_whole_compiler(*str3, &Path(file_label),
|
||||
safe_to_run);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ pub fn parse_and_print(code: @~str) -> ~str {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn has_raw_pointers(c: ast::crate) -> bool {
|
||||
pub fn has_raw_pointers(c: @ast::crate) -> bool {
|
||||
let has_rp = @mut false;
|
||||
fn visit_ty(flag: @mut bool, t: @ast::Ty) {
|
||||
match t.node {
|
||||
|
@ -634,7 +634,7 @@ pub fn check_variants(files: &[Path], cx: Context) {
|
|||
pprust::no_ann(),
|
||||
false)))
|
||||
});
|
||||
check_variants_of_ast(*crate, sess.cm, file, cx);
|
||||
check_variants_of_ast(crate, sess.cm, file, cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ fn build_ctxt(sess: Session,
|
|||
let ast = syntax::ext::expand::expand_crate(sess.parse_sess,
|
||||
copy sess.opts.cfg, ast);
|
||||
let ast = front::test::modify_for_testing(sess, ast);
|
||||
let ast_map = ast_map::map_crate(sess.diagnostic(), *ast);
|
||||
let ast_map = ast_map::map_crate(sess.diagnostic(), ast);
|
||||
|
||||
Ctxt {
|
||||
ast: ast,
|
||||
|
|
|
@ -39,5 +39,5 @@ pub fn from_str_sess(sess: session::Session, source: ~str) -> @ast::crate {
|
|||
}
|
||||
|
||||
fn cfg(sess: session::Session, input: driver::input) -> ast::crate_cfg {
|
||||
driver::build_configuration(sess, @~"rustdoc", input)
|
||||
driver::build_configuration(sess, @~"rustdoc", &input)
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ fn record(repl: Repl, blk: @ast::blk, intr: @token::ident_interner) -> Repl {
|
|||
for blk.node.stmts.each |stmt| {
|
||||
match stmt.node {
|
||||
ast::stmt_decl(*) | ast::stmt_mac(*) => {
|
||||
pprust::print_stmt(pp, **stmt);
|
||||
pprust::print_stmt(pp, *stmt);
|
||||
writer.write_line(~"");
|
||||
}
|
||||
ast::stmt_expr(expr, _) | ast::stmt_semi(expr, _) => {
|
||||
|
@ -101,7 +101,7 @@ fn record(repl: Repl, blk: @ast::blk, intr: @token::ident_interner) -> Repl {
|
|||
ast::expr_assign(*) |
|
||||
ast::expr_assign_op(*) |
|
||||
ast::expr_swap(*) => {
|
||||
pprust::print_stmt(pp, **stmt);
|
||||
pprust::print_stmt(pp, *stmt);
|
||||
writer.write_line(~"");
|
||||
}
|
||||
_ => {}
|
||||
|
@ -147,13 +147,13 @@ fn run(repl: Repl, input: ~str) -> Repl {
|
|||
debug!("building driver configuration");
|
||||
let cfg = driver::build_configuration(sess,
|
||||
@repl.binary,
|
||||
wrapped);
|
||||
&wrapped);
|
||||
|
||||
let outputs = driver::build_output_filenames(wrapped, &None, &None, sess);
|
||||
let outputs = driver::build_output_filenames(&wrapped, &None, &None, sess);
|
||||
debug!("calling compile_upto");
|
||||
let (crate, _) = driver::compile_upto(sess, cfg, wrapped,
|
||||
driver::cu_everything,
|
||||
Some(outputs));
|
||||
let (crate, _) = driver::compile_upto(sess, cfg, &wrapped,
|
||||
driver::cu_everything,
|
||||
Some(outputs));
|
||||
|
||||
let mut opt = None;
|
||||
|
||||
|
@ -198,9 +198,9 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
|
|||
let input = driver::file_input(src_path);
|
||||
let sess = driver::build_session(options, diagnostic::emit);
|
||||
*sess.building_library = true;
|
||||
let cfg = driver::build_configuration(sess, @binary, input);
|
||||
let cfg = driver::build_configuration(sess, @binary, &input);
|
||||
let outputs = driver::build_output_filenames(
|
||||
input, &None, &None, sess);
|
||||
&input, &None, &None, sess);
|
||||
// If the library already exists and is newer than the source
|
||||
// file, skip compilation and return None.
|
||||
let mut should_compile = true;
|
||||
|
@ -228,7 +228,7 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
|
|||
}
|
||||
if (should_compile) {
|
||||
io::println(fmt!("compiling %s...", src_filename));
|
||||
driver::compile_upto(sess, cfg, input, driver::cu_everything,
|
||||
driver::compile_upto(sess, cfg, &input, driver::cu_everything,
|
||||
Some(outputs));
|
||||
true
|
||||
} else { false }
|
||||
|
|
|
@ -37,7 +37,7 @@ use std::{getopts};
|
|||
use syntax::{ast, diagnostic};
|
||||
use util::*;
|
||||
use path_util::{dest_dir, normalize};
|
||||
use rustc::driver::session::{lib_crate, bin_crate, unknown_crate, crate_type};
|
||||
use rustc::driver::session::{lib_crate, bin_crate, crate_type};
|
||||
|
||||
mod conditions;
|
||||
mod usage;
|
||||
|
@ -82,8 +82,8 @@ impl PkgScript {
|
|||
};
|
||||
let input = driver::file_input(script);
|
||||
let sess = driver::build_session(options, diagnostic::emit);
|
||||
let cfg = driver::build_configuration(sess, @binary, input);
|
||||
let (crate, _) = driver::compile_upto(sess, cfg, input,
|
||||
let cfg = driver::build_configuration(sess, @binary, &input);
|
||||
let (crate, _) = driver::compile_upto(sess, cfg, &input,
|
||||
driver::cu_parse, None);
|
||||
let work_dir = dest_dir(id);
|
||||
|
||||
|
@ -112,7 +112,7 @@ impl PkgScript {
|
|||
// Collect together any user-defined commands in the package script
|
||||
let crate = util::ready_crate(sess, self.crate);
|
||||
debug!("Building output filenames with script name %s",
|
||||
driver::source_name(self.input));
|
||||
driver::source_name(&self.input));
|
||||
match filesearch::get_rustpkg_sysroot() {
|
||||
Ok(r) => {
|
||||
let root = r.pop().pop().pop().pop(); // :-\
|
||||
|
|
|
@ -12,7 +12,7 @@ use core::*;
|
|||
use core::cmp::Ord;
|
||||
use core::hash::Streaming;
|
||||
use rustc::driver::{driver, session};
|
||||
use rustc::driver::session::{lib_crate, bin_crate, unknown_crate};
|
||||
use rustc::driver::session::{lib_crate, unknown_crate};
|
||||
use rustc::metadata::filesearch;
|
||||
use std::getopts::groups::getopts;
|
||||
use std::semver;
|
||||
|
@ -25,7 +25,7 @@ use syntax::{ast, attr, codemap, diagnostic, fold};
|
|||
use syntax::ast::{meta_name_value, meta_list, attribute, crate_};
|
||||
use syntax::attr::{mk_attr};
|
||||
use rustc::back::link::output_type_exe;
|
||||
use rustc::driver::session::{lib_crate, bin_crate, unknown_crate, crate_type};
|
||||
use rustc::driver::session::{lib_crate, unknown_crate, crate_type};
|
||||
|
||||
pub type ExitCode = int; // For now
|
||||
|
||||
|
@ -516,9 +516,9 @@ pub fn compile_crate_from_input(input: driver::input,
|
|||
binary: ~str,
|
||||
what: driver::compile_upto) -> @ast::crate {
|
||||
debug!("Calling build_output_filenames with %?", build_dir_opt);
|
||||
let outputs = driver::build_output_filenames(input, &build_dir_opt, &Some(out_file), sess);
|
||||
let outputs = driver::build_output_filenames(&input, &build_dir_opt, &Some(out_file), sess);
|
||||
debug!("Outputs are %? and output type = %?", outputs, sess.opts.output_type);
|
||||
let cfg = driver::build_configuration(sess, @binary, input);
|
||||
let cfg = driver::build_configuration(sess, @binary, &input);
|
||||
match crate_opt {
|
||||
Some(c) => {
|
||||
debug!("Calling compile_rest, outputs = %?", outputs);
|
||||
|
@ -528,7 +528,7 @@ pub fn compile_crate_from_input(input: driver::input,
|
|||
}
|
||||
None => {
|
||||
debug!("Calling compile_upto, outputs = %?", outputs);
|
||||
let (crate, _) = driver::compile_upto(sess, cfg, input,
|
||||
let (crate, _) = driver::compile_upto(sess, cfg, &input,
|
||||
driver::cu_parse, Some(outputs));
|
||||
|
||||
// Inject the inferred link_meta info if it's not already there
|
||||
|
|
Loading…
Reference in New Issue