use serialize::json;
-use std::io;
-use std::io::fs;
-use std::os;
+use std::env;
+use std::ffi::OsString;
+use std::old_io::fs;
+use std::old_io;
use syntax::ast;
use syntax::ast_map;
use syntax::attr;
&id[]));
let mut forest = ast_map::Forest::new(expanded_crate);
+ let arenas = ty::CtxtArenas::new();
let ast_map = assign_node_ids_and_map(&sess, &mut forest);
write_out_deps(&sess, input, &outputs, &id[]);
&ast_map,
&id[]));
- let arenas = ty::CtxtArenas::new();
let analysis = phase_3_run_analysis_passes(sess,
ast_map,
&arenas,
diagnostics::plugin::expand_build_diagnostic_array);
}
- for registrar in registrars.into_iter() {
+ for registrar in registrars {
registry.args_hidden = Some(registrar.args);
(registrar.fun)(&mut registry);
}
{
let mut ls = sess.lint_store.borrow_mut();
- for pass in lint_passes.into_iter() {
+ for pass in lint_passes {
ls.register_pass(Some(sess), true, pass);
}
- for (name, to) in lint_groups.into_iter() {
+ for (name, to) in lint_groups {
ls.register_group(Some(sess), true, name, to);
}
}
// dependent dlls. Note that this uses cfg!(windows) as opposed to
// targ_cfg because syntax extensions are always loaded for the host
// compiler, not for the target.
- let mut _old_path = String::new();
+ let mut _old_path = OsString::from_str("");
if cfg!(windows) {
- _old_path = os::getenv("PATH").unwrap_or(_old_path);
+ _old_path = env::var("PATH").unwrap_or(_old_path);
let mut new_path = sess.host_filesearch(PathKind::All).get_dylib_search_paths();
- new_path.extend(os::split_paths(&_old_path[]).into_iter());
- os::setenv("PATH", os::join_paths(&new_path[]).unwrap());
+ new_path.extend(env::split_paths(&_old_path));
+ env::set_var("PATH", &env::join_paths(new_path.iter()).unwrap());
}
let cfg = syntax::ext::expand::ExpansionConfig {
crate_name: crate_name.to_string(),
syntax_exts,
krate);
if cfg!(windows) {
- os::setenv("PATH", _old_path);
+ env::set_var("PATH", &_old_path);
}
ret
}
// Needs to go *after* expansion to be able to check the results of macro expansion.
time(time_passes, "complete gated feature checking", (), |_| {
- let features =
+ let features =
syntax::feature_gate::check_crate(sess.codemap(),
&sess.parse_sess.span_diagnostic,
&krate);
let resolve::CrateMap {
def_map,
freevars,
- capture_mode_map,
export_map,
trait_map,
external_exports,
named_region_map,
ast_map,
freevars,
- capture_mode_map,
region_map,
lang_items,
stability_index);
time(time_passes, "stability checking", (), |_|
stability::check_unstable_api_usage(&ty_cx));
- time(time_passes, "unknown feature checking", (), |_|
- stability::check_unknown_features(
+ time(time_passes, "unused feature checking", (), |_|
+ stability::check_unused_features(
&ty_cx.sess, lib_features_used));
time(time_passes, "lint checking", (), |_|
lint::check_crate(&ty_cx, &exported_items));
- // Some of the above passes generate errors
+ // The above three passes generate errors w/o aborting
ty_cx.sess.abort_if_errors();
ty::CrateAnalysis {
pub fn phase_6_link_output(sess: &Session,
trans: &trans::CrateTranslation,
outputs: &OutputFilenames) {
- let old_path = os::getenv("PATH").unwrap_or_else(||String::new());
+ let old_path = env::var("PATH").unwrap_or(OsString::from_str(""));
let mut new_path = sess.host_filesearch(PathKind::All).get_tools_search_paths();
- new_path.extend(os::split_paths(&old_path[]).into_iter());
- os::setenv("PATH", os::join_paths(&new_path[]).unwrap());
+ new_path.extend(env::split_paths(&old_path));
+ env::set_var("PATH", &env::join_paths(new_path.iter()).unwrap());
time(sess.time_passes(), "linking", (), |_|
link::link_binary(sess,
outputs,
&trans.link.crate_name[]));
- os::setenv("PATH", old_path);
+ env::set_var("PATH", &old_path);
}
fn escape_dep_filename(filename: &str) -> String {
id: &str) {
let mut out_filenames = Vec::new();
- for output_type in sess.opts.output_types.iter() {
+ for output_type in &sess.opts.output_types {
let file = outputs.path(*output_type);
match *output_type {
config::OutputTypeExe => {
- for output in sess.crate_types.borrow().iter() {
+ for output in &*sess.crate_types.borrow() {
let p = link::filename_for_input(sess, *output,
id, &file);
out_filenames.push(p);
_ => return,
};
- let result = (|&:| -> io::IoResult<()> {
+ let result = (|&:| -> old_io::IoResult<()> {
// Build a list of files used to compile the output and
// write Makefile-compatible dependency rules
let files: Vec<String> = sess.codemap().files.borrow()
.iter().filter(|fmap| fmap.is_real_file())
.map(|fmap| escape_dep_filename(&fmap.name[]))
.collect();
- let mut file = try!(io::File::create(&deps_filename));
- for path in out_filenames.iter() {
+ let mut file = try!(old_io::File::create(&deps_filename));
+ for path in &out_filenames {
try!(write!(&mut file as &mut Writer,
"{}: {}\n\n", path.display(), files.connect(" ")));
}
let res = !link::invalid_output_for_target(session, *crate_type);
if !res {
- session.warn(&format!("dropping unsupported crate type `{:?}` \
+ session.warn(&format!("dropping unsupported crate type `{}` \
for target `{}`",
*crate_type, session.opts.target_triple)[]);
}