diff --git a/Cargo.toml b/Cargo.toml index 4182d1a..32fff95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ compiletest_rs = { version = "0.3", optional = true } [build-dependencies] gcc = { version = "0.3.52", optional = true } +rustc_version = { version = "0.2" } [dev-dependencies] rustyline = "1.0.0" \ No newline at end of file diff --git a/build.rs b/build.rs index 43e5b19..070d1b9 100644 --- a/build.rs +++ b/build.rs @@ -1,13 +1,15 @@ #[cfg(feature = "builtin-lua")] extern crate gcc; +extern crate rustc_version; use std::env; fn main() { let target_os = env::var("CARGO_CFG_TARGET_OS"); let target_family = env::var("CARGO_CFG_TARGET_FAMILY"); - - if target_family == Ok("windows".to_string()) { + if target_family == Ok("windows".to_string()) + && rustc_version::version().unwrap() == rustc_version::Version::parse("1.24.0").unwrap() + { // Error handling is completely broken on windows with // https://github.com/rust-lang/rust/pull/46833 merged, and this includes stable rustc // 1.24.0+. `#[unwind]` fixes error handling on windows, but requires nightly! This