Merge rust-bitcoin/rust-bitcoin#3154: Parse MSRV minor version number from env
b8067da934
Parse MSRV minor version number from env (yancy) Pull request description: Parse MSRV minor version number from env replaces: https://github.com/rust-bitcoin/rust-bitcoin/pull/3145 ACKs for top commit: Kixunil: ACKb8067da934
tcharding: ACKb8067da934
apoelstra: ACKb8067da934
successfully ran local tests Tree-SHA512: 60b3898c9b2739ca4858218b21d5c136b91b6ef45b1dc8f798d97aac861c42d046f114efcefdfa79f514d6da392f715a715ee6b3f230eb459f34e554b48ccf0e
This commit is contained in:
commit
d862077d07
|
@ -1,5 +1,3 @@
|
||||||
const MSRV_MINOR: u64 = 63;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let rustc = std::env::var_os("RUSTC");
|
let rustc = std::env::var_os("RUSTC");
|
||||||
let rustc = rustc.as_ref().map(std::path::Path::new).unwrap_or_else(|| "rustc".as_ref());
|
let rustc = rustc.as_ref().map(std::path::Path::new).unwrap_or_else(|| "rustc".as_ref());
|
||||||
|
@ -26,8 +24,14 @@ fn main() {
|
||||||
.parse::<u64>()
|
.parse::<u64>()
|
||||||
.expect("invalid Rust minor version");
|
.expect("invalid Rust minor version");
|
||||||
|
|
||||||
|
let msrv = std::env::var("CARGO_PKG_RUST_VERSION").unwrap();
|
||||||
|
let mut msrv = msrv.split(".");
|
||||||
|
let msrv_major = msrv.next().unwrap();
|
||||||
|
assert_eq!(msrv_major, "1", "unexpected Rust major version");
|
||||||
|
let msrv_minor = msrv.next().unwrap().parse::<u64>().unwrap();
|
||||||
|
|
||||||
// print cfg for all interesting versions less than or equal to minor
|
// print cfg for all interesting versions less than or equal to minor
|
||||||
for version in MSRV_MINOR..=minor {
|
for version in msrv_minor..=minor {
|
||||||
println!("cargo:rustc-cfg=rust_v_1_{}", version);
|
println!("cargo:rustc-cfg=rust_v_1_{}", version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
const MSRV_MINOR: u64 = 63;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let rustc = std::env::var_os("RUSTC");
|
let rustc = std::env::var_os("RUSTC");
|
||||||
let rustc = rustc.as_ref().map(std::path::Path::new).unwrap_or_else(|| "rustc".as_ref());
|
let rustc = rustc.as_ref().map(std::path::Path::new).unwrap_or_else(|| "rustc".as_ref());
|
||||||
|
@ -26,8 +24,14 @@ fn main() {
|
||||||
.parse::<u64>()
|
.parse::<u64>()
|
||||||
.expect("invalid Rust minor version");
|
.expect("invalid Rust minor version");
|
||||||
|
|
||||||
|
let msrv = std::env::var("CARGO_PKG_RUST_VERSION").unwrap();
|
||||||
|
let mut msrv = msrv.split(".");
|
||||||
|
let msrv_major = msrv.next().unwrap();
|
||||||
|
assert_eq!(msrv_major, "1", "unexpected Rust major version");
|
||||||
|
let msrv_minor = msrv.next().unwrap().parse::<u64>().unwrap();
|
||||||
|
|
||||||
// print cfg for all interesting versions less than or equal to minor
|
// print cfg for all interesting versions less than or equal to minor
|
||||||
for version in MSRV_MINOR..=minor {
|
for version in msrv_minor..=minor {
|
||||||
println!("cargo:rustc-cfg=rust_v_1_{}", version);
|
println!("cargo:rustc-cfg=rust_v_1_{}", version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue