Skip to content

Commit

Permalink
Remove probe_sysroot
Browse files Browse the repository at this point in the history
rust-lang/rust#103660 makes this unnecessary. Closes #2
  • Loading branch information
nbdd0121 committed Apr 20, 2023
1 parent 61e7282 commit a482658
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,9 @@ impl Callbacks for MyCallbacks {
}
}

fn probe_sysroot() -> String {
std::process::Command::new("rustc")
.arg("+1.68.2")
.arg("--print")
.arg("sysroot")
.output()
.ok()
.and_then(|out| String::from_utf8(out.stdout).ok())
.map(|x| x.trim().to_owned())
.expect("failed to probe rust sysroot")
}

fn main() -> ExitCode {
rustc_driver::init_env_logger("KLINT_LOG");
let mut args: Vec<_> = std::env::args().collect();

if !args.iter().any(|x| x == "--sysroot") {
args.push("--sysroot".to_owned());
args.push(probe_sysroot());
}
let args: Vec<_> = std::env::args().collect();

match rustc_driver::RunCompiler::new(&args, &mut MyCallbacks).run() {
Ok(_) => ExitCode::SUCCESS,
Expand Down

0 comments on commit a482658

Please sign in to comment.