Skip to content

Commit

Permalink
Fix compilation with rustc 1.25.0-nightly (4e3901d35 2018-01-23)
Browse files Browse the repository at this point in the history
rustc_driver::get_args is no more, see
rust-lang/rust#47661.
  • Loading branch information
alessandrod committed Jan 24, 2018
1 parent e0fa5b0 commit de51775
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,32 @@ extern crate rustc_trans_utils;
extern crate syntax;

use rustc::middle::cstore::CrateStore;
use rustc::session::Session;
use rustc::session::{Session, early_error};
use rustc::session::config::{self, ErrorOutputType, Input};
use rustc_trans_utils::trans_crate::TransCrate;
use rustc_driver::driver::CompileController;
use rustc_driver::{run_compiler, CompilerCalls, RustcDefaultCalls, Compilation, enable_save_analysis, get_args};
use rustc_driver::{run_compiler, CompilerCalls, RustcDefaultCalls, Compilation, enable_save_analysis};
use syntax::ast;

use std::env;
use std::path::PathBuf;
use std::process;

pub fn run() {
env_logger::init().unwrap();
let result = rustc_driver::run(|| {
let args = env::args_os().enumerate()
.map(|(i, arg)| arg.into_string().unwrap_or_else(|arg| {
early_error(ErrorOutputType::default(),
&format!("Argument {} is not valid Unicode: {:?}", i, arg))
}))
.collect::<Vec<_>>();

let result = rustc_driver::run(|| run_compiler(&get_args(),
&mut ShimCalls,
None,
None));
run_compiler(&args,
&mut ShimCalls,
None,
None)
});
process::exit(result as i32);
}

Expand Down

0 comments on commit de51775

Please sign in to comment.