Skip to content

Commit

Permalink
Move ExitStatus::success check into compile_probe()
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 30, 2023
1 parent 290c450 commit d10baed
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::env;
use std::ffi::OsString;
use std::path::Path;
use std::process::{self, Command, ExitStatus, Stdio};
use std::process::{self, Command, Stdio};
use std::str;

#[cfg(all(feature = "backtrace", not(feature = "std")))]
Expand All @@ -15,13 +15,10 @@ fn main() {
println!("cargo:rerun-if-changed=build/probe.rs");
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");

match compile_probe() {
Some(status) if status.success() => {
println!("cargo:rustc-cfg=std_backtrace");
println!("cargo:rustc-cfg=error_generic_member_access");
error_generic_member_access = true;
}
_ => {}
if compile_probe() {
println!("cargo:rustc-cfg=std_backtrace");
println!("cargo:rustc-cfg=error_generic_member_access");
error_generic_member_access = true;
}
}

Expand Down Expand Up @@ -53,7 +50,7 @@ fn main() {
}
}

fn compile_probe() -> Option<ExitStatus> {
fn compile_probe() -> bool {
if env::var_os("RUSTC_STAGE").is_some() {
// We are running inside rustc bootstrap. This is a highly non-standard
// environment with issues such as:
Expand All @@ -62,7 +59,7 @@ fn compile_probe() -> Option<ExitStatus> {
// https://github.com/rust-lang/rust/issues/114839
//
// Let's just not use nightly features here.
return None;
return false;
}

let rustc = cargo_env_var("RUSTC");
Expand Down Expand Up @@ -101,7 +98,10 @@ fn compile_probe() -> Option<ExitStatus> {
}
}

cmd.status().ok()
match cmd.status() {
Ok(status) => status.success(),
Err(_) => false,
}
}

fn rustc_minor_version() -> Option<u32> {
Expand Down

0 comments on commit d10baed

Please sign in to comment.