Fix compatibility issues with syntax and Bound

This commit is contained in:
Dmitry Shlagoff
2019-01-29 21:32:41 +07:00
parent 0def7da5a8
commit 18b1604fc8
4 changed files with 35 additions and 8 deletions
+15
View File
@@ -14,6 +14,15 @@ fn main() {
let target = env::var("TARGET").unwrap();
let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";
// std::collections::Bound was stabilized in Rust 1.17
// but it was moved to core::ops later in Rust 1.26:
// https://doc.rust-lang.org/core/ops/enum.Bound.html
if minor >= 26 {
println!("cargo:rustc-cfg=ops_bound");
} else if minor >= 17 && cfg!(feature = "std") {
println!("cargo:rustc-cfg=collections_bound");
}
// CString::into_boxed_c_str stabilized in Rust 1.20:
// https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str
if minor >= 20 {
@@ -42,6 +51,12 @@ fn main() {
println!("cargo:rustc-cfg=integer128");
}
// RangeToInclusive was stabilized in Rust 1.26:
// https://doc.rust-lang.org/std/ops/struct.RangeToInclusive.html
if minor >= 26 {
println!("cargo:rustc-cfg=range_to_inclusive");
}
// Inclusive ranges methods stabilized in Rust 1.27:
// https://github.com/rust-lang/rust/pull/50758
if minor >= 27 {