-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The build script detects support for `u128` and `i128` (Rust 1.26+) and enables their `Complex` implementations. We only have to directly implement the operators with scalar LHS, and the rest comes from enabling num-traits' 128-bit `Num`.
- Loading branch information
Showing
7 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
language: rust | ||
rust: | ||
- 1.15.0 | ||
- 1.20.0 | ||
- 1.25.0 | ||
- stable | ||
- beta | ||
- nightly | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use std::env; | ||
use std::io::Write; | ||
use std::process::{Command, Stdio}; | ||
|
||
fn main() { | ||
if probe("fn main() { 0i128; }") { | ||
println!("cargo:rustc-cfg=has_i128"); | ||
} else if env::var_os("CARGO_FEATURE_I128").is_some() { | ||
panic!("i128 support was not detected!"); | ||
} | ||
} | ||
|
||
/// Test if a code snippet can be compiled | ||
fn probe(code: &str) -> bool { | ||
let rustc = env::var_os("RUSTC").unwrap_or_else(|| "rustc".into()); | ||
let out_dir = env::var_os("OUT_DIR").expect("environment variable OUT_DIR"); | ||
|
||
let mut child = Command::new(rustc) | ||
.arg("--out-dir") | ||
.arg(out_dir) | ||
.arg("--emit=obj") | ||
.arg("-") | ||
.stdin(Stdio::piped()) | ||
.spawn() | ||
.expect("rustc probe"); | ||
|
||
child | ||
.stdin | ||
.as_mut() | ||
.expect("rustc stdin") | ||
.write_all(code.as_bytes()) | ||
.expect("write rustc stdin"); | ||
|
||
child.wait().expect("rustc probe").success() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters