Skip to content

Commit

Permalink
Remove nightly detection from protobuf crate
Browse files Browse the repository at this point in the history
  • Loading branch information
stepancheg committed Oct 15, 2024
1 parent 55a539d commit 81eb7a0
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions protobuf/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,6 @@ use std::path::Path;
use std::path::PathBuf;
use std::process;

Check warning on line 8 in protobuf/build.rs

View workflow job for this annotation

GitHub Actions / rustfmt check

unused import: `std::process`

Check warning on line 8 in protobuf/build.rs

View workflow job for this annotation

GitHub Actions / linux stable (with-bytes)

unused import: `std::process`

Check warning on line 8 in protobuf/build.rs

View workflow job for this annotation

GitHub Actions / Miri test

unused import: `std::process`

// % rustc +stable --version
// rustc 1.26.0 (a77568041 2018-05-07)
// % rustc +beta --version
// rustc 1.27.0-beta.1 (03fb2f447 2018-05-09)
// % rustc +nightly --version
// rustc 1.27.0-nightly (acd3871ba 2018-05-10)
fn version_is_nightly(version: &str) -> bool {
version.contains("nightly")
}

fn cfg_rust_version() {
let rustc = env::var("RUSTC").expect("RUSTC unset");
let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER").filter(|w| !w.is_empty()) {
let mut cmd = process::Command::new(wrapper);
cmd.arg(rustc);
cmd
} else {
process::Command::new(rustc)
};

let mut child = cmd
.args(&["--version"])
.stdin(process::Stdio::null())
.stdout(process::Stdio::piped())
.spawn()
.expect("spawn rustc");

let mut rustc_version = String::new();

child
.stdout
.as_mut()
.expect("stdout")
.read_to_string(&mut rustc_version)
.expect("read_to_string");
assert!(child.wait().expect("wait").success());

if version_is_nightly(&rustc_version) {
println!("cargo:rustc-cfg=rustc_nightly");
}
}

fn cfg_serde() {
match env::var("CARGO_FEATURE_WITH_SERDE") {
Ok(_) => {
Expand Down

0 comments on commit 81eb7a0

Please sign in to comment.