Skip to content
Myr

Move ExitStatus::success check into compile_probe()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 290c450 · Browse files · 1 file+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−11 removed

  • other:+11 added−11 removed

1 file+11 added−11 removed

modified:build.rs+11 added-11 removed
1use std::env;2use std::ffi::OsString;3use std::path::Path;4use std::process::{self, Command, ExitStatus, Stdio};4use std::process::{self, Command, Stdio};5use std::str;67#[cfg(all(feature = "backtrace", not(feature = "std")))]8compile_error! {
5 unmodified lines
14 if cfg!(feature = "std") {15 println!("cargo:rerun-if-changed=build/probe.rs");16 println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");1718 match compile_probe() {19 Some(status) if status.success() => {20 println!("cargo:rustc-cfg=std_backtrace");21 println!("cargo:rustc-cfg=error_generic_member_access");22 error_generic_member_access = true;23 }24 _ => {}18 if compile_probe() {19 println!("cargo:rustc-cfg=std_backtrace");20 println!("cargo:rustc-cfg=error_generic_member_access");21 error_generic_member_access = true;22 }23 }2425 let rustc = match rustc_minor_version() {
23 unmodified lines
49 println!("cargo:rustc-cfg=std_backtrace");50 }51}5256fn compile_probe() -> Option<ExitStatus> {53fn compile_probe() -> bool {54 if env::var_os("RUSTC_STAGE").is_some() {55 // We are running inside rustc bootstrap. This is a highly non-standard56 // environment with issues such as:57 //58 // https://github.com/rust-lang/cargo/issues/1113859 // https://github.com/rust-lang/rust/issues/11483960 //61 // Let's just not use nightly features here.65 return None;62 return false;63 }6465 let rustc = cargo_env_var("RUSTC");66 let out_dir = cargo_env_var("OUT_DIR");
30 unmodified lines
97 }98 }99 }100104 cmd.status().ok()101 match cmd.status() {102 Ok(status) => status.success(),103 Err(_) => false,104 }105}106107fn rustc_minor_version() -> Option<u32> {108 let rustc = env::var_os("RUSTC")?;
18 unmodified lines