Skip to content

Commit a9b1585

Browse files
committed
Move ExitStatus::success check into compile_probe()
1 parent 0f349a4 commit a9b1585

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

build.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
use std::env;
22
use std::ffi::OsString;
33
use std::path::Path;
4-
use std::process::{self, Command, ExitStatus, Stdio};
4+
use std::process::{self, Command, Stdio};
55

66
fn main() {
77
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
88

9-
match compile_probe() {
10-
Some(status) if status.success() => println!("cargo:rustc-cfg=error_generic_member_access"),
11-
_ => {}
9+
if compile_probe() {
10+
println!("cargo:rustc-cfg=error_generic_member_access");
1211
}
1312
}
1413

15-
fn compile_probe() -> Option<ExitStatus> {
14+
fn compile_probe() -> bool {
1615
if env::var_os("RUSTC_STAGE").is_some() {
1716
// We are running inside rustc bootstrap. This is a highly non-standard
1817
// environment with issues such as:
@@ -21,7 +20,7 @@ fn compile_probe() -> Option<ExitStatus> {
2120
// https://github.com/rust-lang/rust/issues/114839
2221
//
2322
// Let's just not use nightly features here.
24-
return None;
23+
return false;
2524
}
2625

2726
let rustc = cargo_env_var("RUSTC");
@@ -60,7 +59,10 @@ fn compile_probe() -> Option<ExitStatus> {
6059
}
6160
}
6261

63-
cmd.status().ok()
62+
match cmd.status() {
63+
Ok(status) => status.success(),
64+
Err(_) => false,
65+
}
6466
}
6567

6668
fn cargo_env_var(key: &str) -> OsString {

0 commit comments

Comments
 (0)